:root{--dark:#202020;--green:#39d5a1;--grey:#d3d3d3}*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#202020;color:#ededed;font-family:Roboto,'Arial','Noto Sans',sans-serif;-webkit-user-select:none;user-select:none}button{appearance:none;-webkit-appearance:none;border:0;border-radius:0;font:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.calculator{height:100vh;height:100dvh;width:100%;margin:auto;display:flex;flex-direction:column;background:var(--dark);overflow:hidden}.screen{flex:0 0 42.5%;position:relative;min-height:0;background:var(--dark)}.fake-status{position:absolute;top:0;left:0;right:0;height:25px;display:flex;align-items:center;gap:3px;padding:0 7px;font-size:10px;color:#dedede;font-weight:600}.status-left{font-size:10px;color:#77b9ff}.status-right{margin-left:auto;font-size:11px}.record{position:absolute;left:50%;transform:translateX(-50%);min-width:76px;height:21px;background:#050505;border:1px solid #5b1c20;border-radius:12px;display:flex;align-items:center;justify-content:space-between;padding:0 8px;color:#ee5555;font-size:9px}.red-dot{font-size:13px}.menu{position:absolute;top:34px;left:8px;width:18px;height:20px;padding:2px;background:transparent;display:flex;flex-direction:column;justify-content:space-evenly}.menu span{height:1px;width:13px;background:#878787}.history-line{position:absolute;right:10px;bottom:65px;max-width:93%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;font-size:20px;font-weight:300;color:#e5e5e5}.result{position:absolute;bottom:5px;right:10px;max-width:94%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;font-size:29px;font-weight:300;line-height:1.3}.down{position:absolute;left:6px;bottom:25px;width:20px;height:22px;background:none;color:#646464;padding:0}.keys{height:57.5%;flex:1;min-height:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(5,minmax(0,1fr));background:var(--grey)}.keys button{min-width:0;min-height:0;border-right:1px solid #bcbcbc;border-bottom:1px solid #bcbcbc;background:#d3d3d3;color:#282828;font-size:28px;font-weight:300;line-height:1}.keys button.action{background:var(--green);border-color:#27c796}.keys button:active,.keys button.pressed{filter:brightness(.9)}.keys .equals{grid-column:4;grid-row:4/span 2}.keys .zero{grid-column:1/span 2}.overlay{position:absolute;inset:0;z-index:5;background:#0009;display:flex;align-items:center;justify-content:center;padding:20px}.overlay[hidden]{display:none}.panel{background:#292929;border-radius:13px;padding:22px;width:min(400px,100%);max-height:85%;overflow-y:auto;box-shadow:0 10px 40px #0008}.panel h2{margin:0 0 14px;font-size:22px}.panel h3{font-size:17px;margin:20px 0 10px}.setting{display:flex;align-items:center;justify-content:space-between;padding:12px 0;border-bottom:1px solid #444}.setting input{accent-color:var(--green);width:22px;height:22px}.panel-btn{display:block;width:100%;background:#4a4a4a;color:white;padding:12px;border-radius:6px;margin:12px 0}.panel-btn.primary{background:var(--green);color:#17251f;font-weight:600}.history-list{max-height:200px;overflow:auto;color:#ddd;font-size:14px}.history-item{padding:8px 0;border-bottom:1px solid #444}.hint{font-size:12px;line-height:1.6;color:#999}@media(min-width:600px){.calculator{max-width:460px;box-shadow:0 0 0 1px #333}}@media(max-height:580px){.keys button{font-size:24px}.result{font-size:25px}}

.sound-status{font-size:13px;color:#a7efd7;line-height:1.5;min-height:20px;margin:4px 0 8px;overflow-wrap:anywhere}

/* V15: history is visible ABOVE the active expression, exactly as in video */
.screen-history{position:absolute;top:44px;bottom:92px;left:40px;right:9px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:none;text-align:right;display:flex;flex-direction:column;align-items:flex-end;gap:2px;padding-bottom:3px;touch-action:pan-y;-webkit-overflow-scrolling:touch}
.screen-history::-webkit-scrollbar,.history-full-scroll::-webkit-scrollbar{display:none}
.screen-history .history-entry{width:100%;flex:0 0 auto;text-align:right;color:#e4e4e4;font-size:clamp(13px,3.4vw,17px);line-height:1.28;font-weight:300;word-break:break-all;overflow-wrap:anywhere}
.history-line{display:none}
.history-full{position:absolute;inset:0;z-index:7;background:#202020;display:flex;flex-direction:column;padding-top:34px;color:#eee}
.history-full[hidden]{display:none}
.history-close{position:absolute;left:8px;top:4px;background:transparent;color:#bcbcbc;font-size:13px;padding:8px 12px;z-index:1}
.history-full-scroll{flex:1;min-height:0;padding:16px 9px 8px 30px;overflow:auto;text-align:right;scrollbar-width:none;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
.history-full-scroll .history-entry{font-size:clamp(14px,3.4vw,17px);line-height:1.65;word-break:break-all;overflow-wrap:anywhere}
.history-footer{display:grid;grid-template-columns:1fr 1fr;height:72px;flex:0 0 72px}
.history-footer button{background:var(--grey);color:#202020;font-size:40px;font-weight:400;line-height:1;font-family:Roboto,Arial,'Noto Sans',sans-serif;padding:0;box-shadow:inset -0.5px 0 0 #404040, inset 0 -0.5px 0 #404040}
.history-footer button:last-child{background:#43dfa2;color:#202020}
@media(min-width:600px){.screen-history .history-entry,.history-full-scroll .history-entry{font-size:16px}}
@media(max-height:600px){.screen-history{top:38px;bottom:63px}.screen-history .history-entry{font-size:12px}.history-footer{height:58px;flex-basis:58px}.history-footer button{font-size:30px}}
/* Keep the expanded history inside the calculator width on desktop. */
.calculator{position:relative}

/* V16: history text exactly matches active expression size and weight */
.screen-history .history-entry,.history-full-scroll .history-entry{font-size:29px!important;font-weight:300!important;line-height:1.3!important}
.screen-history{top:8px!important;bottom:64px!important;left:8px!important}
@media(max-height:580px){.screen-history .history-entry,.history-full-scroll .history-entry{font-size:25px!important}}
.fake-status{display:none!important}

/* Reference screenshot visual calibration (V23). Keep calculator and sound logic unchanged. */
:root {
  --dark: #202020;
  --green: #43dfa2;
  --grey: #d5d5d5;
}

/* The reference uses square key cells (four columns by five rows). */
.screen { flex: 1 1 auto; }
.keys {
  height: auto;
  flex: 0 0 auto;
  aspect-ratio: 4 / 5;
  grid-template-rows: repeat(5, minmax(0, 1fr));
}
.keys button {
  background: var(--grey);
  color: #202020;
  font-family: Roboto, Arial, 'Noto Sans', sans-serif;
  font-size: 40px;
  font-weight: 400;
  line-height: 1;
  padding: 2px 0 0;
  border: 0;
  /* Hairline dividers, instead of the browser minimum 1px CSS borders. */
  box-shadow: inset -0.5px 0 0 #404040, inset 0 -0.5px 0 #404040;
}
.keys button.action {
  background: var(--operator-green);
  padding-top: 5px;
}
/* The reference C is smaller than the digit keys. */
.keys button[data-key="C"] {
  font-family: Arial, Roboto, sans-serif;
  font-size: 30px;
  font-weight: 400;
  padding-top: 12px;
  padding-left: 2px;
}
.keys button.backspace { padding-top: 5px; }
.keys button.backspace svg {
  display: block;
  width: 40px;
  height: 30px;
  margin: 0 auto;
}

/* Smaller but clearer menu / history icons, placed as in the screenshot. */
.menu {
  top: 10px;
  left: 10px;
  width: 28px;
  height: 20px;
  padding: 2px;
  justify-content: space-between;
}
.menu span {
  width: 20px;
  height: 2px;
  background: #8c8c8c;
  border-radius: 2px;
}
.down {
  left: 8px;
  bottom: 72px;
  width: 29px;
  height: 29px;
  color: #626262;
}
.down svg {
  width: 29px;
  height: 29px;
  stroke-width: 1.15;
}

/* Preserve usability in unusually short/landscape windows. */
@media (max-height: 580px) {
  .screen { flex: 0 0 42.5%; }
  .keys { height: 57.5%; flex: 1 1 auto; aspect-ratio: auto; }
  .keys button { font-size: 32px; }
  .keys button[data-key="C"] { font-size: 26px; }
  .down { bottom: 25px; }
}

/* V25: match the new reference video. Keep the history on the same screen;
   the five-row keypad slides DOWN, and the very same arrow slides it UP. */
.calculator {
  --key-height: 125vw; /* 4 square columns × 5 rows = 5/4 viewport width */
  --footer-height: max(72px, 15vw); /* proportional to the video, never smaller than V24 */
  --closed-arrow-gap: 19vw;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.screen {
  position: absolute;
  inset: 0;
  flex: none;
  z-index: 1;
}
.result {
  bottom: calc(var(--key-height) + 5px);
  transition: opacity 120ms linear;
}
.screen-history {
  bottom: calc(var(--key-height) + 64px) !important;
  transition: bottom 420ms cubic-bezier(.4,0,.2,1);
}
.history-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: var(--footer-height);
  z-index: 2;
}
.keys {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: var(--key-height);
  flex: none;
  aspect-ratio: auto;
  z-index: 3;
  transition: transform 420ms cubic-bezier(.4,0,.2,1);
  will-change: transform;
}
.down {
  bottom: calc(var(--key-height) + var(--closed-arrow-gap));
  z-index: 4;
  transition: bottom 420ms cubic-bezier(.4,0,.2,1);
}
.down svg path { transform-origin: 12px 12px; transition: transform 420ms cubic-bezier(.4,0,.2,1); }
.history-open .keys { transform: translateY(100%); pointer-events: none; }
.history-open .down { bottom: calc(var(--footer-height) + 27px); }
.history-open .down svg path { transform: rotate(180deg); }
.history-open .result { opacity: 0; }
.history-open .screen-history { bottom: calc(var(--footer-height) + 64px) !important; }
/* Preserve the phone-width layout in a desktop preview. */
@media (min-width:600px) {
 .calculator { --key-height: 575px; --footer-height: 72px; --closed-arrow-gap: 86px; }
}
/* Short/landscape windows retain working keys and a visible history toggle. */
@media (max-height:580px) {
 .calculator { --key-height: 57.5dvh; --footer-height: 55px; --closed-arrow-gap: 24px; }
 .keys { height: var(--key-height); flex: none; aspect-ratio: auto; }
 .screen { flex: none; }
 .down { bottom: calc(var(--key-height) + var(--closed-arrow-gap)); }
}
/* The full-history writing grows to the reference video's readable top-line size. */
.history-open .screen-history .history-entry {
  font-size: clamp(29px, 6.8vw, 40px) !important;
  font-weight: 300 !important;
  line-height: 1.3 !important;
}
@media (min-width:600px) {
  .history-open .screen-history .history-entry { font-size: 40px !important; }
}
/* The history log can scroll, but must never cover the settings menu. */
.menu { z-index: 6; }

/* V27: full-screen mobile menu based on reference video. */
:root {
  --digit-font-size: 40px;
  --c-font-size: 30px;
  --history-footer-font-size: 24px;
  --operator-green: #43dfa2;
}
.keys button { font-size: var(--digit-font-size) !important; }
.keys button[data-key="C"] { font-size: var(--c-font-size) !important; }
.history-footer {
  height: 60px !important;
  flex-basis: 60px !important;
}
.history-footer button {
  font-size: var(--history-footer-font-size) !important;
  font-weight: 400 !important;
}
.mobile-menu-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: #efeff4;
  padding: 0;
  display: block;
  overflow: hidden;
}
.mobile-menu-overlay[hidden] { display:none; }
.app-pages {
  height: 100%;
  overflow: hidden;
  background: #efeff4;
  color: #303133;
  font-family: -apple-system,BlinkMacSystemFont,'PingFang SC','Helvetica Neue',Arial,sans-serif;
}
.app-page {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #efeff4;
}
.home-hero {
  background: #1f8fe5;
  color: #fff;
  padding: 16px 16px 20px;
  text-align: center;
  position: relative;
}
.home-hero h2, .page-bar h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}
.home-hero h2 { padding-top: 22px; }
.top-back {
  position: absolute;
  left: 12px;
  top: 18px;
  width: 26px;
  height: 26px;
  background: transparent;
  padding: 0;
}
.top-back span {
  position: absolute;
  left: 7px;
  top: 5px;
  width: 12px;
  height: 12px;
  border-left: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(45deg);
}
.top-back-light { color:#fff; }
.hero-avatar-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  margin: 24px auto 10px;
}
.hero-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #ececec 0 30%, #d4d4d4 31% 55%, #efefef 56% 100%);
  border: 2px solid rgba(255,255,255,.6);
}
.vip-badge {
  position: absolute;
  right: -2px;
  top: 0;
  min-width: 34px;
  height: 26px;
  padding: 0 4px;
  border-radius: 13px;
  background: linear-gradient(180deg,#cf151b,#f4a013);
  color: #ffd66f;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 1px rgba(0,0,0,.16);
}
.hero-login {
  font-size: 18px;
  line-height: 1.2;
}
.ios-group {
  margin-top: 12px;
  background: #fff;
  border-top: 1px solid #ececf1;
  border-bottom: 1px solid #ececf1;
}
.spacer-top { margin-top: 22px; }
.ios-row {
  width: 100%;
  min-height: 50px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  color: #333;
  font-size: 18px;
  border-bottom: 1px solid #ececf1;
  text-align: left;
  position: relative;
}
.ios-group > .ios-row:last-child,
.ios-group > label.ios-row:last-child { border-bottom: 0; }
.ios-label { flex: 1 1 auto; }
.ios-value { margin-left: auto; color: #6a6a6a; font-size: 17px; }
.ios-blue, .ios-link { color: #1e78ea; }
.ios-muted { color: #8e8e93; }
.ios-arrow::after {
  content: '';
  position: absolute;
  right: 16px;
  width: 9px;
  height: 9px;
  border-top: 1.8px solid #c8c7cc;
  border-right: 1.8px solid #c8c7cc;
  transform: rotate(45deg);
}
.skin-swatch {
  width: 31px;
  height: 31px;
  background: var(--operator-green);
  margin-right: 18px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
}
.ios-switch-row { justify-content: space-between; }
.ios-switch {
  appearance: none;
  -webkit-appearance: none;
  width: 48px;
  height: 31px;
  border-radius: 999px;
  background: #dcdde1;
  position: relative;
  flex: 0 0 auto;
  margin: 0;
}
.ios-switch::before {
  content: '';
  position: absolute;
  width: 27px;
  height: 27px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
  transition: transform .22s ease;
}
.ios-switch:checked { background: #58ca5c; }
.ios-switch:checked::before { transform: translateX(17px); }
.page-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 64px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #ececf1;
}
.page-bar .top-back { color: #383838; top: 18px; }
.page-action {
  position: absolute;
  right: 14px;
  top: 18px;
  padding: 0;
  background: transparent;
  color: #1e78ea;
  font-size: 16px;
}
.ios-check-row .checkmark {
  width: 18px;
  height: 11px;
  border-left: 2.6px solid transparent;
  border-bottom: 2.6px solid transparent;
  transform: rotate(-45deg);
  margin-left: auto;
}
.ios-check-row.selected .checkmark {
  border-left-color: #2d83f5;
  border-bottom-color: #2d83f5;
}
.color-chip, .custom-chip {
  width: 31px;
  height: 31px;
  border-radius: 2px;
  flex: 0 0 auto;
}
.custom-chip {
  background: linear-gradient(90deg,#ef2964 0 25%, #ffc300 25% 50%, #19d178 50% 75%, #5967ff 75% 100%);
}
.ios-link-row { min-height: 56px; }
.ios-footer {
  color: #9898a0;
  font-size: 13px;
  line-height: 1.7;
  padding: 18px 18px 28px;
}
.agreement { display:flex; align-items:flex-start; gap:8px; }
.agreement input { margin-top: 2px; width: 20px; height: 20px; }
.备案号 { text-align:center; margin-top: 18px; font-size: 11px; }
.font-preview {
  background: #fff;
  margin-top: 0;
}
.font-preview-screen {
  background: #202020;
  color: #fff;
  padding: 12px 14px 8px;
  min-height: 154px;
  text-align: right;
  font-weight: 300;
  line-height: 1.36;
  font-size: 42px;
}
.font-preview-keys { width: 100%; }
.font-row { display:grid; grid-template-columns: repeat(4, 1fr); }
.font-row > span {
  min-height: 68px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#d5d5d5;
  color:#202020;
  font-size: 29px;
  border-right: .5px solid rgba(45,45,45,.45);
  border-bottom: .5px solid rgba(45,45,45,.45);
}
.font-row.mint > span, .font-row > span.mint-col { background:#43dfa2; }
.font-row > span.wide { grid-column: span 2; }
.font-slider-box {
  background:#fff;
  margin-top: 0;
  padding: 14px 16px 22px;
}
.font-scale-labels {
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  padding: 0 2px 6px;
  color:#333;
}
.font-scale-labels span { font-size: 23px; }
.font-scale-labels span.active { color:#1e78ea; }
.font-scale-labels span.big { font-size: 42px; line-height: 1; }
.font-slider { width: 100%; }
.font-slider {
  appearance: none;
  -webkit-appearance: none;
  height: 2px;
  background: #b8b8bc;
}
.font-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #b9cae8;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
@media (min-width:600px) {
  .mobile-menu-overlay { left: 50%; transform: translateX(-50%); max-width: 460px; }
}
.choose-color-wrap {
  padding: 18px 12px 24px;
  background:#fff;
  min-height: calc(100% - 64px);
}
.color-wheel-input {
  display:block;
  width: 82px;
  height: 82px;
  border:0;
  margin: 4px auto 18px;
  background: transparent;
  padding:0;
}
.quick-colors {
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:center;
}
.quick-color {
  width: 46px;
  height: 34px;
  border: 1px solid #d5d5da;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.4);
}
.quick-color.active { outline: 2px solid #000; }
.keyboard-page { padding: 18px 0 28px; display:flex; justify-content:center; }
.keyboard-card {
  width: 190px;
  background:#fff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  overflow:hidden;
  position:relative;
}
.keyboard-vip {
  position:absolute; right:0; top:0; background:#ff9800; color:#fff; font-size:12px; font-weight:700; padding:4px 8px; border-bottom-left-radius:8px;
}
.keyboard-preview-top { height: 70px; background:#202020; }
.keyboard-mini-grid { display:grid; grid-template-columns: repeat(4,1fr); }
.keyboard-mini-grid span {
  min-height: 29px; display:flex; align-items:center; justify-content:center; background:#d5d5d5; color:#202020; font-size:12px; border-right:.5px solid rgba(45,45,45,.35); border-bottom:.5px solid rgba(45,45,45,.35);
}
.keyboard-mini-grid span.op { background: var(--operator-green); }
.keyboard-mini-grid span.wide { grid-column: span 2; }
.keyboard-check { text-align:center; color:#58ca5c; font-size:24px; padding:8px 0 12px; }
.app-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  background: rgba(32,32,32,.92);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 60;
  opacity: 0;
  transition: .18s ease;
  pointer-events: none;
}
.app-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* V29 polish closer to video */
.ios-row[data-open-page] { cursor:pointer; }
.choose-color-wrap {
  padding: 0;
  min-height: calc(100% - 64px);
  background:#efeff4;
}
.color-wheel-input {
  display:block;
  width: 92px;
  height: 92px;
  border:0;
  margin: 18px auto;
  background: transparent;
  padding:0;
}
.palette-strip {
  margin-top: 8px;
  background:#fff;
  padding: 18px 18px 24px;
  display:flex;
  gap:16px;
  justify-content:flex-start;
}
.palette-swatch {
  width: 92px;
  height: 92px;
  max-width: calc((100vw - 100px)/5);
  max-height: calc((100vw - 100px)/5);
  min-width: 60px;
  min-height: 60px;
  border: 0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 34px;
  color:#111;
  position:relative;
}
.palette-swatch.selected { outline: 2px solid #111; outline-offset: -2px; }
.palette-swatch span { font-weight:500; }
.keyboard-page {
  padding: 18px 10px 32px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items:start;
}
.keyboard-card {
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}
.keyboard-preview {
  background:#fff;
  overflow:hidden;
}
.keyboard-preview-top { height: 150px; background:#202020; }
.keyboard-mini-grid { display:grid; grid-template-columns: repeat(4,1fr); }
.keyboard-mini-grid span {
  min-height: 44px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#d5d5d5;
  color:#202020;
  font-size:23px;
  border-right:.5px solid rgba(45,45,45,.45);
  border-bottom:.5px solid rgba(45,45,45,.45);
}
.keyboard-mini-grid span.op { background: var(--operator-green); }
.keyboard-mini-grid span.extra { background:#3367f0; color:#fff; }
.keyboard-vip {
  position:absolute; right:0; top:0; background:#ff8b00; color:#fff; font-size:18px; font-weight:700; padding:4px 10px; border-bottom-left-radius:10px;
}
.keyboard-card { position:relative; }
.radio-check {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #c5c5cc;
  margin: 18px auto 0;
  position:relative;
  background:#efeff4;
}
.radio-check.on { background:#63cf5d; border-color:#63cf5d; }
.radio-check.on::before {
  content:'';
  position:absolute;
  left:11px; top:8px;
  width: 20px; height: 10px;
  border-left: 4px solid #fff;
  border-bottom: 4px solid #fff;
  transform: rotate(-45deg);
}
.color-row.selected .checkmark,
.palette-swatch.selected .checkmark { border-left-color:#2d83f5; border-bottom-color:#2d83f5; }
.custom-chip { background:linear-gradient(90deg,#f01861 0 25%, #ffb300 25% 50%, #15d565 50% 75%, #4a63ff 75% 100%); }
/* keep bottom buttons close to video */
.history-footer { height: 58px !important; flex-basis:58px !important; }
.history-footer button { font-size: 22px !important; }
@media (min-width:600px) {
  .palette-swatch { width:92px; height:92px; }
}
/* V29 actual keyboard switching */
.keys button.extra-key {
  background:#3367f0 !important;
  color:#fff !important;
  border-color:#2d59d2 !important;
  font-size: 22px !important;
}
.calculator.vip-layout .keys {
  grid-template-rows: repeat(5,minmax(0,1fr));
}
.calculator.vip-layout .keys button {
  font-size: clamp(20px, 5.4vw, 34px) !important;
}
.calculator.left-notes .screen-history,
.calculator.left-notes .history-entry { text-align:left !important; align-items:flex-start; }


/* V43: match menu width to the calculator on both desktop and mobile. */
.mobile-menu-overlay{
  inset:0;
  left:0;
  right:0;
  width:100%;
  max-width:none;
  transform:none;
  height:100%;
  border-radius:0;
}
@media (min-width:600px){
  .mobile-menu-overlay{left:0;right:0;width:100%;max-width:none;transform:none;}
}
.app-pages{width:100%;height:100%;min-width:0;}
.app-page{width:100%;height:100%;overflow-x:hidden;overflow-y:auto;scrollbar-gutter:stable;overscroll-behavior-y:contain;}
.home-hero{width:100%;padding:16px clamp(14px,4.1vw,24px) 22px;}
.home-hero h2{text-align:center;font-size:clamp(19px,4.1vw,22px);padding-left:28px;padding-right:28px;}
.hero-avatar-wrap{width:clamp(80px,22vw,100px);height:clamp(80px,22vw,100px);margin:22px auto 12px;}
.hero-login{max-width:100%;overflow-wrap:anywhere;text-align:center;}
.ios-group{width:100%;}
.ios-row{
  width:100%;
  min-width:0;
  min-height:clamp(54px,11vw,62px);
  padding:8px clamp(16px,4.5vw,24px);
  gap:12px;
  text-align:left;
  font-size:clamp(16px,3.6vw,19px);
  line-height:1.45;
}
.ios-label{flex:1 1 auto;min-width:0;white-space:normal;overflow-wrap:anywhere;}
.ios-row .ios-value{min-width:0;flex:0 1 auto;max-width:50%;text-align:right;white-space:normal;overflow-wrap:anywhere;font-size:clamp(14px,3.4vw,17px)}
.ios-arrow{padding-right:40px}
.ios-arrow::after{right:17px;flex:none}
.ios-switch{width:50px;min-width:50px;flex:none;}
.skin-swatch{margin-right:4px;flex:none;}
.page-bar{height:64px;min-height:64px;position:sticky;top:0;z-index:11;padding:0 75px;background:#fff;}
.page-bar h2{font-size:clamp(18px,4.5vw,22px);line-height:1.2;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center;}
.page-bar .top-back{left:14px;top:19px;}
.page-bar .page-action{right:clamp(12px,3.8vw,20px);top:0;height:64px;display:flex;align-items:center;justify-content:center;font-size:clamp(13px,3.5vw,16px);white-space:nowrap;}
.ios-check-row .checkmark{flex:none;margin-left:auto;}
.color-row .color-chip,.color-row .custom-chip{flex:none;}
.ios-footer{padding:20px clamp(14px,4vw,24px) 32px;}
.keyboard-page{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  justify-content:center;
  align-items:start;
  gap:clamp(9px,2.5vw,18px);
  padding:20px clamp(12px,3.5vw,20px) 28px;
}
.keyboard-card{width:100%;max-width:none;min-width:0;overflow:visible;}
.keyboard-preview{width:100%;border-radius:5px;overflow:hidden;}
.keyboard-preview-top{height:clamp(85px,22vw,145px)}
.keyboard-mini-grid span{height:clamp(28px,9vw,46px);min-height:0;font-size:clamp(15px,4.5vw,23px)}
.radio-check{width:34px;height:34px;margin:14px auto 0}
.radio-check.on::before{left:8px;top:7px;width:16px;height:8px;border-width:3px}
.font-preview{width:100%;max-width:100%}
.font-preview-screen{width:100%;min-height:clamp(145px,32vh,240px);font-size:clamp(24px,7vw,42px);overflow:hidden;}
.font-preview-screen>div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.font-row>span{font-size:clamp(24px,7vw,35px);min-height:clamp(58px,15vw,90px)}
.font-slider-box{width:100%;padding:18px 20px 30px;}
.choose-color-wrap{min-height:calc(100% - 64px)}
.palette-strip{width:100%;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:clamp(6px,1.6vw,14px);padding:16px clamp(12px,3.3vw,18px) 22px}
.palette-swatch{max-width:100%;max-height:none;min-width:0;min-height:0;width:100%;height:auto;aspect-ratio:1;border-radius:2px;font-size:clamp(16px,5vw,34px)}
.color-wheel-input{max-width:100%;}
@media (max-width:390px){
  .home-hero{padding-bottom:18px}
  .ios-row{padding-left:16px;padding-right:16px}
  .ios-arrow{padding-right:35px}
  .ios-arrow::after{right:13px}
  .page-bar{padding:0 66px}
  .page-bar h2{font-size:18px}
  .font-preview-screen{font-size:30px}
  .keyboard-mini-grid span{font-size:16px}
}
/* Keep the white settings rows truly full width, without a 15px scrollbar gutter. */
.app-page{scrollbar-gutter:auto;scrollbar-width:none;}
.app-page::-webkit-scrollbar{display:none;}

/* V51 — show latest typed terms; overflow clips the left side, not the latest right side. */
.screen .result {
  display:block!important;
  width:calc(100% - 18px)!important;
  max-width:none!important;
  left:9px!important;
  right:9px!important;
  overflow:hidden!important;
  white-space:nowrap!important;
  text-align:right!important;
  text-overflow:clip!important;
}
.screen .result .result-tail {
  display:block;
  width:max-content;
  min-width:100%;
  max-width:none;
  text-align:right;
  white-space:nowrap;
  overflow:visible;
  margin-left:auto;
  font-variant-numeric:tabular-nums;
}
.keys button{touch-action:none!important;user-select:none;-webkit-user-select:none;outline-offset:-3px}
.keys button.pressed{filter:brightness(.89)}
/* Balanced, accessible bottom actions in expanded history. */
.history-footer{height:64px!important;flex-basis:64px!important;grid-template-columns:1fr 1fr!important}
.history-footer button{font-size:23px!important;font-weight:400!important;min-width:0;text-align:center;display:flex;align-items:center;justify-content:center;border-top:1px solid #80808040}
.history-footer button:first-child{background:#d5d5d5!important;color:#202020;border-right:1px solid #92929280}
.history-footer button:last-child{background:#43dfa2!important;color:#202020}
.history-footer button:active{filter:brightness(.94)}
.history-open .screen-history .history-entry{cursor:context-menu;touch-action:pan-y}
.history-open .screen-history .history-entry:focus-visible{outline:2px solid #43dfa2;outline-offset:-2px}
.history-delete-backdrop[hidden]{display:none!important}
.history-delete-backdrop{position:fixed;inset:0;z-index:50;background:#0009;display:grid;place-items:center;padding:20px}
.history-delete-panel{background:#fff;color:#18293d;width:min(390px,100%);border-radius:16px;padding:23px 20px;box-shadow:0 20px 65px #0005;font-family:system-ui,-apple-system,sans-serif}
.history-delete-panel h2{font-size:20px;margin:0 0 9px;line-height:1.4}
.history-delete-panel p{margin:10px 0;font-size:14px;line-height:1.6}
.history-delete-note{color:#64748b}
.history-delete-preview{background:#f3f6fa;border-radius:10px;padding:10px 12px;max-height:90px;overflow:auto;word-break:break-all}
.history-delete-message{color:#b52c2c;min-height:15px}
.history-delete-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:16px}
.history-delete-actions button{font-size:16px;min-height:46px;border-radius:9px;background:#edf1f7;color:#253750}
.history-delete-actions button:last-child{background:#d64040;color:#fff}
.history-delete-actions button:disabled{opacity:.5}
@media(max-width:390px){.history-footer{height:60px!important;flex-basis:60px!important}.history-footer button{font-size:21px!important}}
/* Flex end-pinning makes latest characters visible even when text exceeds screen width. */
.screen .result{display:flex!important;justify-content:flex-end!important;align-items:center!important;}
.screen .result .result-tail{flex:0 0 auto;margin-left:0!important;}

/* V52: compact bottom action sheet matching the reference video */
.history-delete-backdrop{align-items:end;justify-items:center;padding:0;background:rgba(0,0,0,.55)}
.history-delete-panel{width:min(100%,560px);border-radius:16px 16px 0 0;padding:12px 12px max(16px,env(safe-area-inset-bottom));box-shadow:0 -8px 32px #0003}
.history-delete-panel h2{font-size:14px;text-align:center;font-weight:500;color:#7d8692;margin:4px 0 8px}
.history-delete-preview{font-size:13px;max-height:52px;overflow:auto;margin:0 0 8px!important;background:#f4f5f7;text-align:center}
.history-action-menu{display:grid;gap:1px;background:#edf0f4;border-radius:10px;overflow:hidden}
.history-action-menu button{background:white;color:#253244;min-height:52px;border:0;font-size:16px;font-weight:400}
.history-action-menu #historyDeleteConfirm{color:#d94444}
.history-action-menu #historyDeleteCancel{margin-top:7px;color:#697485}
.history-entry{cursor:pointer;touch-action:pan-y}

/* V54: continue from history result; all actions fit within the sheet. */
.history-action-menu .history-continue-action{font-weight:600;color:#1e70c9;background:#f7fbff}
.history-action-menu button:focus-visible{outline:2px solid #2b7de0;outline-offset:-2px}

/* V57: unlimited history via lazy-loaded cursor pages, not a fixed 50-row cap. */
.screen-history .history-load-older{align-self:stretch;width:100%;min-height:38px;flex:0 0 auto;border-radius:8px;background:#303438;color:#c9d9e8;font-size:13px;font-weight:400;padding:8px;text-align:center;cursor:pointer}
.screen-history .history-load-older[disabled]{opacity:.7;cursor:wait}


/* V74 — reference-video date row.
   The date is part of .screen-history, occupies its own full row, and therefore
   scrolls vertically together with the equations instead of floating on screen. */
.current-record-date{
  position:static;
  align-self:stretch;
  flex:0 0 auto;
  width:100%;
  min-height:30px;
  box-sizing:border-box;
  overflow:hidden;
  white-space:nowrap;
  text-align:left;
  color:var(--operator-green);
  font-family:-apple-system,BlinkMacSystemFont,'PingFang SC','Helvetica Neue',Arial,sans-serif;
  font-size:22px;
  font-weight:400;
  line-height:1.3;
  font-variant-numeric:tabular-nums;
  pointer-events:none;
  text-shadow:0 0 0 currentColor;
  padding:0 0 2px 0;
}
.current-record-date[hidden]{display:none!important;}
/* The menu remains below the date row while that row is at the top of history. */
.screen.record-date-visible .menu{top:43px;}
@media(max-width:360px){.current-record-date{font-size:20px;min-height:27px;}}
@media(max-height:580px){.current-record-date{font-size:19px;min-height:25px}.screen.record-date-visible .menu{top:36px;}}
