:root {
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans JP",sans-serif;
  color:#183c35;
  background:#e9eeeb;
  font-synthesis:none;
  --green:#123f38;
  --muted:#5d7069;
  --line:#d7e2da;
  --accent:#d5ed80
}

* {
  box-sizing:border-box
}
body {
  margin:0;
  padding:20px 12px max(20px,env(safe-area-inset-bottom))
}
button,input,textarea {
  font:inherit
}
button {
  cursor:pointer;
  touch-action:manipulation;
  color:inherit;
  border:1px solid var(--line);
  background:#fff;
  border-radius:12px;
  min-height:44px
}
button:hover {
  filter:brightness(.97)
}
button:active {
  transform:translateY(1px)
}
button:disabled {
  cursor:default;
  opacity:.5
}
button:focus-visible,input:focus-visible,textarea:focus-visible {
  outline:3px solid #517aaa;
  outline-offset:2px
}
[hidden] {
  display:none!important
}
.calculator {
  max-width:440px;
  margin:auto;
  background:#f8faf7;
  border:1px solid #d4ded6;
  border-radius:24px;
  padding:18px;
  box-shadow:0 18px 60px #17392d14
}
.app-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px
}
.brand {
  display:flex;
  align-items:center;
  gap:9px
}
.brand-icon {
  background:var(--green);
  color:var(--accent);
  border-radius:10px;
  font-size:27px;
  width:34px;
  height:34px;
  display:grid;
  place-items:center
}
h1 {
  font-size:20px;
  letter-spacing:.04em;
  margin:0
}
h2 {
  font-size:21px;
  margin:0
}
h3 {
  font-size:16px;
  margin-top:24px
}
.text-button {
  background:transparent;
  border:0;
  min-height:40px;
  font-size:14px;
  font-weight:600;
  padding:4px 8px
}
.status-row {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:5px 12px;
  color:var(--muted);
  font-size:12px;
  padding:3px 0 10px
}
.status-row button {
  min-height:30px;
  font-size:12px;
  padding:2px 8px
}
.summary {
  display:grid;
  grid-template-columns:1fr 1.35fr;
  border:1px solid var(--line);
  border-radius:13px;
  background:#edf3ed;
  overflow:hidden;
  margin-bottom:12px
}
.summary>div,.summary>button {
  padding:9px 12px;
  min-width:0
}
.summary>button {
  background:transparent;
  border:0;
  border-left:1px solid var(--line);
  border-radius:0;
  text-align:left
}
.summary span {
  display:block;
  font-size:12px;
  color:var(--muted)
}
.summary span span {
  display:inline
}
.summary small {
  font-size:12px;
  margin-left:4px
}
.summary strong {
  display:block;
  font-size:21px;
  font-weight:600;
  overflow-wrap:anywhere;
  font-variant-numeric:tabular-nums;
  margin-top:2px
}
.summary b {
  color:var(--green)
}
.display {
  padding:12px 14px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px
}
.input-heading,.expression-heading,.result-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  font-size:12px;
  color:var(--muted)
}
.input-heading label {
  font-size:13px
}
.input-heading small {
  font-size:11px;
  color:#718279;
  margin-left:3px
}
.input-heading button {
  font-size:12px;
  min-height:28px;
  padding:2px 0 2px 8px
}
textarea {
  display:block;
  width:100%;
  resize:vertical;
  border:0;
  border-bottom:1px solid #e6ece7;
  background:transparent;
  border-radius:0;
  min-height:38px;
  padding:5px 0 7px;
  font-size:16px;
  line-height:1.6;
  color:#52645e
}
textarea::placeholder {
  color:#7a8781;
  font-size:14px
}
.interim {
  font-size:13px;
  color:var(--muted);
  overflow-wrap:anywhere
}
.interim:empty {
  display:none
}
.expression-heading {
  margin-top:9px
}
#expression {
  font-size:25px;
  text-align:right;
  color:var(--green);
  font-variant-numeric:tabular-nums;
  width:100%;
  border:0;
  background:transparent;
  padding:5px 0;
  min-height:43px
}
#conversion-note {
  font-size:11px
}
#result {
  display:block;
  font-size:clamp(27px,9vw,42px);
  line-height:1.2;
  font-weight:650;
  text-align:right;
  letter-spacing:-.03em;
  overflow-wrap:anywhere;
  font-variant-numeric:tabular-nums;
  min-height:50px
}
#rounding {
  font-size:11px
}
.message {
  font-size:13px;
  line-height:1.4;
  min-height:32px;
  display:flex;
  align-items:center;
  padding:5px 2px;
  overflow-wrap:anywhere
}
.message.error,.warning {
  color:#a22f24
}
.warning {
  font-size:13px;
  padding:10px;
  background:#fff0ea;
  border-radius:8px
}
.voice-controls {
  margin:2px 0 9px
}
.mic-button {
  width:100%;
  background:var(--green);
  color:white;
  border:0;
  min-height:56px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:11px;
  font-size:17px;
  font-weight:600
}
.mic-button svg {
  height:24px;
  width:24px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8
}
.mic-dot {
  width:8px;
  height:8px;
  border-radius:50%;
  background:var(--accent)
}
.mic-button[aria-pressed=true] {
  background:#a03b2d
}
.mic-button[aria-pressed=true] .mic-dot {
  background:white;
  animation:pulse 1.2s infinite
}
.voice-options {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:6px;
  font-size:11px;
  color:var(--muted);
  padding:7px 0 0
}
.voice-options label {
  white-space:nowrap;
  display:flex;
  align-items:center;
  font-size:12px;
  min-height:28px
}
.voice-options input {
  width:17px;
  height:17px;
  accent-color:var(--green);
  margin:0 5px 0 0
}
.voice-options span {
  text-align:right;
  max-width:60%
}
.memory-keys {
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:7px;
  margin-bottom:8px
}
.memory-keys button {
  background:#edf3ed;
  font-size:14px;
  font-weight:600;
  min-height:40px
}
.keypad {
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:8px
}
.keypad button {
  font-size:25px;
  min-height:53px;
  box-shadow:0 2px 0 #dce3dd;
  font-weight:500
}
.keypad .operator {
  background:#e6eee5;
  font-size:29px
}
.keypad .clear-key {
  color:#aa3d2f;
  background:#faf0eb
}
.keypad [data-action=clear-entry],.keypad [data-action=backspace],.keypad .clear-key {
  font-size:19px
}
.keypad .equals-key {
  background:var(--accent);
  border-color:#c6df6c;
  color:#193d2e
}
.zero-key {
  grid-column:span 2
}
.document-actions {
  display:grid;
  grid-template-columns:1fr 1.6fr;
  gap:8px;
  margin-top:14px
}
.document-actions button {
  font-size:14px;
  font-weight:600;
  min-height:47px
}
.document-actions .next-button {
  background:var(--green);
  color:white;
  border-color:var(--green);
  display:flex;
  align-items:center;
  justify-content:space-around
}
footer {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:5px;
  margin-top:7px
}
footer>span {
  font-size:11px;
  color:var(--muted)
}
#history-count {
  display:inline-block;
  min-width:21px;
  background:#e8eee7;
  border-radius:5px;
  margin-left:4px;
  font-size:12px
}
.command-panel {
  display:flex;
  gap:6px;
  align-items:center;
  padding:8px;
  background:#eef4db;
  margin-bottom:8px;
  border-radius:10px;
  font-size:14px
}
.command-panel span {
  flex:1
}
.command-panel button {
  padding:4px 10px;
  font-size:13px
}
dialog {
  border:1px solid var(--line);
  border-radius:20px;
  width:min(480px,calc(100vw - 24px));
  max-height:85dvh;
  padding:20px;
  color:#183c35;
  box-shadow:0 25px 80px #163d3533
}
dialog::backdrop {
  background:#102d296e;
  backdrop-filter:blur(3px)
}
.dialog-header {
  display:flex;
  align-items:center;
  justify-content:space-between
}
.dialog-header button {
  width:44px;
  font-size:27px
}
dialog p,dialog li {
  font-size:15px;
  line-height:1.85
}
dialog ol {
  padding-left:22px
}
dialog li {
  margin-bottom:10px
}
.muted {
  color:var(--muted);
  font-size:13px!important
}
.records {
  display:grid;
  gap:8px;
  margin:18px 0
}
.record {
  border:1px solid var(--line);
  border-radius:10px;
  padding:12px;
  overflow-wrap:anywhere
}
.record-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:6px;
  font-size:12px;
  color:var(--muted)
}
.record p {
  font-size:16px;
  margin:6px 0;
  line-height:1.5
}
.record strong {
  font-size:22px
}
.record button {
  padding:3px 12px;
  font-size:13px
}
.danger {
  color:#a22f24;
  padding:8px 16px;
  width:100%
}
.total-display {
  padding:20px 0;
  border-bottom:1px solid var(--line)
}
.total-display span {
  font-size:14px
}
.total-display strong {
  display:block;
  font-size:32px;
  overflow-wrap:anywhere
}
.empty {
  padding:24px;
  text-align:center;
  color:var(--muted)
}
@keyframes pulse {
  50% {
  opacity:.3
}

}
@media(prefers-reduced-motion:reduce) {
  * {
  animation:none!important
}

}
@media(max-width:480px) {
  body {
  padding:0;
  background:#f8faf7
}
.calculator {
  border:0;
  box-shadow:none;
  border-radius:0;
  max-width:440px;
  padding:10px 14px max(10px,env(safe-area-inset-bottom))
}
.summary {
  margin-bottom:9px
}
.keypad button {
  min-height:52px
}
.status-row {
  padding-bottom:7px
}

}
@media(max-width:360px) {
  .calculator {
  padding-left:10px;
  padding-right:10px
}
.voice-options {
  align-items:flex-start
}
.keypad {
  gap:6px
}
.display {
  padding:9px 11px
}
.input-heading small {
  display:none
}

}
@media(orientation:landscape) and (max-height:600px) {
  body {
  padding:10px
}
.calculator {
  max-width:640px
}
.keypad button {
  min-height:48px
}

}

@media(max-width:480px) {
  .app-header {
  min-height:36px
}
.app-header .text-button {
  min-height:36px
}
.status-row {
  line-height:16px;
  padding:0 0 6px
}
.summary>div,.summary>button {
  padding:6px 11px
}
.summary strong {
  font-size:20px
}
.summary {
  margin-bottom:7px
}
.display {
  padding:8px 12px
}
.input-heading {
  line-height:18px
}
.input-heading button {
  min-height:22px
}
textarea {
  min-height:32px;
  height:32px;
  line-height:22px;
  padding:3px 0 5px
}
.expression-heading {
  margin-top:5px;
  line-height:16px
}
#expression {
  min-height:36px;
  height:36px;
  font-size:23px;
  padding:3px 0
}
.result-heading {
  line-height:16px
}
#result {
  font-size:35px;
  min-height:42px
}
.message {
  min-height:29px;
  font-size:12px
}
.voice-controls {
  margin-bottom:6px
}
.mic-button {
  min-height:52px
}
.voice-options {
  padding-top:3px
}
.memory-keys {
  gap:6px;
  margin-bottom:6px
}
.memory-keys button {
  min-height:40px
}
.keypad {
  gap:6px
}
.keypad button {
  min-height:48px
}
.document-actions {
  margin-top:10px
}
.document-actions button {
  min-height:44px
}
footer {
  margin-top:3px
}
footer .text-button {
  min-height:34px
}

}

