@import url("./theme.css");
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
:root {
  font-family:
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
  color-scheme: light;
}
body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(ellipse at 15% 15%, #e7e1f647, transparent 50%),
    radial-gradient(ellipse at 95% 85%, #e0edf448, transparent 45%), var(--page);
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
button {
  border: 0;
}
a {
  color: var(--accent);
}
.masthead {
  max-width: 1160px;
  margin: auto;
  padding: 32px 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  font-size: 24px;
  letter-spacing: -1px;
  font-weight: 620;
}
.brand-solve {
  margin-left: 5px;
  font-weight: 380;
  color: #8a7ca2;
}
.header-actions {
  display: flex;
  gap: 18px;
  align-items: center;
}
.connection {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}
.connection.ready:before {
  content: "";
  width: 6px;
  height: 6px;
  background: #759783;
  border-radius: 50%;
}
.icon-button {
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  background: transparent;
  color: var(--muted);
}
main {
  max-width: 1030px;
  margin: 18px auto 50px;
  padding: 0 28px;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 510px) minmax(240px, 310px);
  gap: 74px;
  justify-content: center;
  align-items: start;
}
.calculator {
  border: 1px solid #e1dce9;
  background: var(--shell);
  padding: 24px;
  border-radius: 28px;
  box-shadow:
    0 20px 60px -35px #62547345,
    0 2px 4px #6f5b8b08;
}
.calculator-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 3px 16px;
  font-size: 10px;
  letter-spacing: 1.7px;
  font-weight: 650;
  color: var(--accent);
}
.caption-detail {
  font-weight: 400;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.display {
  position: relative;
  background: var(--screen);
  border: 1px solid #e6e1ed;
  min-height: 190px;
  border-radius: 16px;
  padding: 14px 17px 12px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px #8b7c9f06;
}
.display-status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 10px;
  letter-spacing: 0.4px;
  color: #9b91ab;
  margin-bottom: 15px;
  height: 15px;
}
.display-status button {
  color: var(--accent);
  background: var(--soft-accent);
  border-radius: 4px;
  padding: 3px 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.display-status #shift-indicator {
  margin-left: auto;
  font-weight: 700;
  color: var(--accent);
}
.expression {
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-size: 23px;
  letter-spacing: 0.2px;
  height: 35px;
  padding: 0;
  outline-offset: 3px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  caret-color: var(--accent);
  border-radius: 3px;
}
.expression::placeholder {
  color: #b5aebe;
}
.math-preview {
  color: var(--muted);
  min-height: 20px;
  max-height: 36px;
  overflow: auto;
  font-size: 16px;
  padding-top: 3px;
  scrollbar-width: thin;
}
.result {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 49px;
  overflow-x: auto;
  font-size: 34px;
  font-weight: 450;
  white-space: nowrap;
  letter-spacing: -0.7px;
  padding: 3px 0;
  scrollbar-width: thin;
}
.result math {
  font-size: inherit;
  flex-shrink: 0;
}
.result.error {
  color: #a24f66;
  font-size: 22px;
  letter-spacing: 0;
}
.display-hint {
  font-size: 10px;
  color: var(--muted);
  min-height: 13px;
  text-align: right;
  padding-top: 6px;
}
.navigation {
  display: grid;
  grid-template-columns: 1.15fr 1.15fr 1fr 0.8fr 0.8fr 0.8fr 0.8fr 1fr;
  gap: 5px;
  margin: 13px 0 10px;
}
.navigation button {
  min-height: 44px;
  border-radius: 10px;
  background: transparent;
  color: #8b819b;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-size: 24px;
  line-height: 1;
}
.navigation small {
  font-size: 7px;
  margin-top: 4px;
  letter-spacing: 0.1px;
}
.navigation .nav-symbol {
  font-size: 20px;
}
.navigation .ok {
  font-size: 11px;
  font-weight: 700;
  background: #eae5f2;
}
.function-menu {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-bottom: 12px;
}
.function-menu button {
  padding: 8px 0;
  min-height: 40px;
  border-radius: 7px;
  font-size: 8px;
  letter-spacing: 0.45px;
  font-weight: 650;
  background: #f2eef7;
  color: #80718f;
}
.function-menu button:first-child {
  background: #e8def6;
  color: var(--accent);
}
.function-menu button.active {
  background: var(--accent);
  color: white;
}
.scientific-keys {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  margin-bottom: 12px;
}
.key {
  position: relative;
  border: 1px solid #e6e1eb;
  border-radius: 11px;
  min-width: 0;
  min-height: 47px;
  background: var(--key);
  font-size: 20px;
  font-weight: 450;
  box-shadow: 0 2px 1px #897d9e07;
  user-select: none;
  -webkit-user-select: none;
  padding: 12px 1px 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition:
    background 0.12s,
    transform 0.06s;
}
.key .secondary {
  position: absolute;
  top: 4px;
  right: 7px;
  color: #9b86b6;
  font-size: 8px;
  font-weight: 500;
  line-height: 1;
}
.key .primary {
  white-space: nowrap;
}
.key.small {
  font-size: 16px;
}
.number-keys {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.number-keys .key {
  font-size: 24px;
  min-height: 55px;
  border-radius: 12px;
  background: #fff;
}
.number-keys .key.operator {
  background: #f1edf7;
  color: var(--accent);
  font-size: 26px;
  border-color: #e4ddec;
}
.number-keys .key.utility {
  font-size: 13px;
  color: #9c7284;
  background: #f6edf1;
  border-color: #eddee5;
}
.number-keys .key.format {
  font-size: 10px;
  color: #7a668f;
  background: #f0eaf7;
  font-weight: 650;
  letter-spacing: 0.5px;
}
.number-keys .key.execute {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  font-size: 15px;
  font-weight: 650;
  box-shadow: 0 3px 5px #77619030;
}
.number-keys .key.small {
  font-size: 17px;
}
.key:active,
.navigation button:active,
.function-menu button:active {
  transform: translateY(1px);
  filter: brightness(0.97);
}
.key.active-shift .primary {
  color: var(--accent);
}
.companion {
  padding-top: 23px;
}
.companion-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 1.65px;
  color: #9a8eaa;
  font-weight: 550;
}
.orbit-decoration {
  font-size: 27px;
  color: #b9abc9;
}
h1 {
  font-family: ui-serif, Georgia, serif;
  font-size: 38px;
  font-weight: 400;
  line-height: 1.17;
  letter-spacing: -1.3px;
  margin: 23px 0 13px;
}
.intro {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
  margin: 0 0 32px;
  max-width: 255px;
}
.aside-tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.aside-tabs button {
  font-size: 12px;
  background: transparent;
  padding: 0 0 12px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.aside-tabs button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
#history-panel {
  max-height: 285px;
  overflow: auto;
  scrollbar-width: thin;
}
.empty-state {
  font-size: 12px;
  line-height: 1.9;
  color: #aba2b6;
  padding: 26px 0 40px;
}
.history-item {
  display: block;
  width: 100%;
  text-align: right;
  background: transparent;
  padding: 13px 1px;
  border-bottom: 1px solid #e6e0ed80;
}
.history-item .history-expression {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  margin-bottom: 7px;
}
.history-result {
  font-size: 19px;
  font-weight: 450;
  color: #726285;
}
.aside-footer {
  display: flex;
  gap: 9px;
  border-top: 1px solid var(--border);
  padding-top: 15px;
  margin-top: 28px;
}
.tiny-star {
  color: #a78bbd;
  font-size: 18px;
}
.aside-footer p {
  margin: 0;
  font-size: 10px;
  line-height: 1.8;
  color: #a69bb2;
}
.guide-card {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}
.guide-card strong {
  display: block;
  color: #79668f;
  font-size: 12px;
  margin-bottom: 4px;
}
.guide-card p {
  margin: 0;
}
.guide-card kbd,
kbd {
  display: inline-block;
  font:
    10px ui-monospace,
    monospace;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 4px;
  background: #fff;
}
.mobile-note {
  display: none;
}
.menu-screen {
  position: absolute;
  inset: 0;
  background: var(--screen);
  padding: 15px;
  overflow: auto;
  z-index: 2;
  scrollbar-width: thin;
}
.menu-title {
  font-size: 11px;
  color: var(--accent);
  font-weight: 650;
  letter-spacing: 0.5px;
  padding: 0 4px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.menu-close {
  background: transparent;
  font-size: 18px;
  color: var(--muted);
  min-width: 30px;
  min-height: 26px;
}
.menu-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  min-height: 34px;
  padding: 8px;
  border-radius: 7px;
  background: transparent;
  font-size: 13px;
  color: var(--ink);
}
.menu-row.selected {
  background: var(--soft-accent);
  color: var(--accent);
}
.menu-value {
  color: var(--muted);
  font-size: 10px;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mode-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 12px;
}
.mode-content {
  font-size: 12px;
}
.mode-content p {
  line-height: 1.7;
  color: var(--muted);
  margin: 7px 0;
}
.mode-content .field {
  font-size: 11px;
}
.mode-content textarea {
  width: 100%;
  min-height: 75px;
  resize: vertical;
  max-height: 200px;
  background: var(--key);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px;
  font-family: ui-monospace, monospace;
  font-size: 14px;
  color: var(--ink);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  margin: 9px 0;
}
.field input,
.field select {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px;
  background: var(--key);
  color: var(--ink);
  width: 100%;
  min-height: 36px;
  font-size: 16px;
}
.field-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.primary-button,
.quiet-button {
  padding: 9px 13px;
  border-radius: 8px;
  font-size: 12px;
  min-height: 38px;
  background: var(--accent);
  color: white;
}
.quiet-button {
  background: var(--soft-accent);
  color: var(--accent);
}
.mode-actions {
  display: flex;
  gap: 8px;
  margin: 11px 0;
  flex-wrap: wrap;
}
.table-scroll {
  max-height: 230px;
  overflow: auto;
  scrollbar-width: thin;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
th,
td {
  padding: 8px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--accent);
  font-weight: 550;
  position: sticky;
  top: 0;
  background: var(--screen);
}
th:first-child,
td:first-child {
  text-align: left;
}
.mode-error {
  color: #a24f66 !important;
  font-size: 12px;
  white-space: pre-wrap;
}
.results-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 15px;
  font-variant-numeric: tabular-nums;
  margin: 8px 0;
}
.results-list div {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}
.results-list span {
  color: var(--muted);
}
#mode-screen {
  max-height: 380px;
  overflow: auto;
  scrollbar-width: thin;
}
.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: #463850;
  color: #fff;
  font-size: 12px;
  padding: 13px 20px;
  border-radius: 12px;
  box-shadow: 0 5px 30px #57426233;
  z-index: 20;
  max-width: 90vw;
  width: max-content;
}
dialog {
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 25px;
  width: min(540px, calc(100% - 28px));
  max-height: 85svh;
  color: var(--ink);
  background: var(--shell);
  box-shadow: 0 30px 150px #47335c33;
}
dialog::backdrop {
  background: #30243e44;
  backdrop-filter: blur(3px);
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.dialog-heading h2 {
  font-family: ui-serif, Georgia, serif;
  font-weight: 400;
  font-size: 27px;
  margin: 0;
  letter-spacing: -0.5px;
}
.dialog-heading button {
  background: transparent;
  font-size: 27px;
  min-width: 40px;
  min-height: 40px;
  color: var(--muted);
}
#help-content {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}
#help-content h3 {
  font-size: 13px;
  color: var(--accent);
  margin: 20px 0 7px;
}
#help-content p {
  margin: 7px 0;
}
#help-content ul {
  padding-left: 18px;
}
#help-content a {
  overflow-wrap: anywhere;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.no-script {
  position: fixed;
  inset: 50px 15px auto;
  padding: 20px;
  background: white;
  border: 1px solid var(--border);
  z-index: 10;
}
.data-editor td {
  padding: 3px;
}
.data-editor input {
  width: 100%;
  min-width: 55px;
  font-size: 16px;
  background: var(--key);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 7px 4px;
}
.data-editor th {
  font-size: 11px;
}
.subtle {
  font-size: 10px !important;
  color: var(--muted);
}
@media (hover: hover) {
  .key:hover {
    border-color: #cdbfdf;
    background: #f6f2fb;
  }
  .navigation button:hover,
  .function-menu button:hover {
    background: #e8e0f1;
  }
  .menu-row:hover {
    background: var(--soft-accent);
  }
}
@media (min-width: 1400px) {
  main {
    margin-top: 55px;
  }
  .workspace {
    gap: 105px;
  }
}
@media (max-width: 850px) {
  .workspace {
    grid-template-columns: minmax(0, 480px);
    gap: 0;
  }
  .companion {
    display: none;
  }
  .masthead {
    max-width: 540px;
    padding: 20px 28px;
  }
  main {
    padding: 0 16px;
    margin: 5px auto 25px;
  }
  .mobile-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    max-width: 465px;
    margin: 16px auto 0;
    font-size: 9px;
    color: #a99eb5;
  }
  .mobile-note button {
    background: transparent;
    color: #8e7a9f;
    font-size: 10px;
    min-height: 32px;
    padding: 6px 10px;
  }
  .connection {
    font-size: 10px;
    max-width: 150px;
  }
  .header-actions {
    gap: 10px;
  }
}
@media (max-width: 480px) {
  .masthead {
    padding: calc(13px + env(safe-area-inset-top)) 23px 14px;
  }
  .brand {
    font-size: 22px;
  }
  .brand img {
    width: 28px;
    height: 28px;
  }
  main {
    padding: 0 12px;
  }
  .calculator {
    padding: 17px 15px 19px;
    border-radius: 23px;
  }
  .calculator-caption {
    margin-bottom: 12px;
    font-size: 9px;
  }
  .caption-detail {
    font-size: 9px;
  }
  .display {
    min-height: 175px;
    padding: 12px 14px;
  }
  .display-status {
    margin-bottom: 11px;
  }
  .result {
    font-size: 32px;
  }
  .navigation {
    margin: 10px 0 8px;
    gap: 2px;
  }
  .function-menu {
    gap: 4px;
    margin-bottom: 10px;
  }
  .function-menu button {
    font-size: 7px;
    letter-spacing: 0.3px;
    min-height: 40px;
  }
  .scientific-keys {
    gap: 6px;
    margin-bottom: 10px;
  }
  .key {
    min-height: 45px;
    font-size: 19px;
    border-radius: 9px;
  }
  .number-keys {
    gap: 7px;
  }
  .number-keys .key {
    min-height: 53px;
    border-radius: 10px;
  }
  .connection {
    max-width: 125px;
    font-size: 9px;
  }
  .icon-button {
    width: 29px;
    height: 29px;
  }
  .display-hint {
    font-size: 9px;
  }
  .mobile-note {
    margin-top: 9px;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .field-row {
    gap: 6px;
  }
}
@media (max-width: 360px) {
  main {
    padding: 0 6px;
  }
  .calculator {
    padding: 13px 10px;
  }
  .caption-detail {
    display: none;
  }
  .masthead {
    padding-left: 15px;
    padding-right: 15px;
  }
  .key .secondary {
    right: 4px;
    font-size: 7px;
  }
  .function-menu button {
    font-size: 6px;
  }
  .number-keys .key {
    min-height: 49px;
  }
}
@media (max-height: 780px) and (max-width: 480px) {
  .masthead {
    padding-top: calc(7px + env(safe-area-inset-top));
    padding-bottom: 8px;
  }
  .display {
    min-height: 153px;
  }
  .math-preview {
    min-height: 14px;
    max-height: 25px;
    font-size: 14px;
  }
  .result {
    min-height: 40px;
    font-size: 28px;
  }
  .key {
    min-height: 42px;
  }
  .number-keys .key {
    min-height: 47px;
  }
  .navigation button {
    min-height: 44px;
  }
  .calculator {
    padding-top: 14px;
  }
  .mobile-note {
    margin-top: 3px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
