@font-face {
  font-family: "Unbounded";
  src: url("fonts/unbounded.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #F4F0E8;
  --paper-deep: #EBE5D9;
  --sheet: #FFFDF9;
  --ink: #1F1B16;
  --ink-soft: #675F55;
  --ink-faint: #A0968A;
  --rule: #EDE6DA;
  --line: #DCD3C3;
  --signal: #E2492F;
  --signal-deep: #A9321C;
  --signal-soft: #FADBD1;
  --margin: #EDA391;
  --on-signal: #FFF8F3;
  --display: "Unbounded", system-ui, sans-serif;
  --text: "Nunito", system-ui, sans-serif;
  --lh: 2.05rem;
  --pad: 1.4rem;
  --gutter: 3.6rem;
  --ease: cubic-bezier(0.2, 0.85, 0.25, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.38 0 0 0 0 0.3 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)'/%3E%3C/svg%3E");
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 2.5px solid var(--ink);
  outline-offset: 3px;
}

h2,
h3 {
  margin: 0;
  font-family: var(--display);
  letter-spacing: -0.02em;
}

.app {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-columns: minmax(0, 1fr);
  height: 100dvh;
  max-width: 880px;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 0.8rem) max(env(safe-area-inset-right), 1rem) 0 max(env(safe-area-inset-left), 1rem);
}

.top {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.1rem 0.9rem;
  animation: rise 0.6s var(--ease) backwards;
}

.brand {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-right: auto;
}

.mark {
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  color: var(--ink);
}

.mark .dot {
  fill: var(--signal);
}

.recording .mark .dot {
  animation: blink 1.1s ease-in-out infinite;
}

.word {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.28rem;
  letter-spacing: -0.035em;
}

.plan {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 0;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: var(--sheet);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.plan.due {
  background: var(--signal);
  color: var(--on-signal);
  box-shadow: none;
}

.icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 2.65rem;
  height: 2.65rem;
  padding: 0 0.65rem;
  border: 0;
  border-radius: 999px;
  background: var(--sheet);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-weight: 800;
  font-size: 0.9rem;
}

.icon svg {
  width: 1.3rem;
  height: 1.3rem;
}

.icon span,
.plan .more {
  display: none;
}

.icon.on {
  background: var(--ink);
  color: var(--paper);
  box-shadow: none;
}

.desk {
  position: relative;
  min-height: 0;
  animation: rise 0.7s 0.08s var(--ease) backwards;
}

.sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-bottom: 2.6rem;
  overflow: hidden;
  background: var(--sheet);
  border-radius: 1.6rem;
  box-shadow:
    0 1px 0 var(--line),
    0 26px 50px -30px rgba(70, 48, 26, 0.38);
  transition: box-shadow 0.4s var(--ease);
}

.sheet::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--gutter) - 0.9rem);
  width: 1.5px;
  background: var(--margin);
  opacity: 0.75;
  pointer-events: none;
}

.recording .sheet {
  box-shadow:
    inset 0 0 0 2px var(--signal-soft),
    0 1px 0 var(--line),
    0 26px 50px -30px rgba(226, 73, 47, 0.45);
}

textarea {
  flex: 1;
  min-height: 5rem;
  width: 100%;
  margin: 0;
  border: 0;
  outline: none;
  resize: none;
  padding: var(--pad) var(--pad) var(--pad) var(--gutter);
  background-color: transparent;
  background-image: linear-gradient(to bottom, transparent calc(var(--lh) - 1px), var(--rule) calc(var(--lh) - 1px));
  background-size: 100% var(--lh);
  background-position: 0 var(--pad);
  background-attachment: local;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: var(--lh);
  caret-color: var(--signal);
  overscroll-behavior: contain;
}

textarea:focus-visible {
  outline: none;
}

textarea::placeholder {
  color: var(--ink-faint);
  opacity: 1;
}

::selection {
  background: var(--signal-soft);
}

.live {
  margin: 0 var(--pad) 1rem var(--gutter);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.5;
  animation: pop 0.35s var(--ease) backwards;
}

.live span {
  background: linear-gradient(transparent 60%, var(--signal-soft) 60%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.live.idle span {
  background: none;
  color: var(--ink-faint);
  font-weight: 600;
}

.blink {
  display: inline-block;
  width: 0.62rem;
  height: 0.62rem;
  margin: 0 0.6rem 0.1rem calc(-0.9rem - 0.31rem - 0.6rem);
  vertical-align: middle;
  border-radius: 50%;
  background: var(--signal);
  animation: blink 1.1s ease-in-out infinite;
}

.card {
  position: relative;
  z-index: 1;
  flex: none;
  margin: 0 0.85rem 0.85rem;
  padding: 1.2rem 1.3rem 1.25rem;
  border-radius: 1.3rem;
  background: var(--paper);
  box-shadow: inset 0 0 0 1.5px var(--line);
  animation: pop 0.45s var(--ease) backwards;
}

.card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.card p {
  margin: 0.55rem 0 0;
  color: var(--ink-soft);
  font-weight: 600;
}

.card .hint {
  padding: 0.7rem 0.9rem;
  border-radius: 0.9rem;
  border: 1.5px dashed var(--margin);
  color: var(--ink);
}

.price {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.row:empty {
  display: none;
}

.primary,
.quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0 1.25rem;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.15s var(--ease), opacity 0.2s;
}

.primary {
  background: var(--ink);
  color: var(--paper);
}

.quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line);
}

.primary:active,
.quiet:active,
.side:active {
  transform: scale(0.97);
}

.primary:disabled,
.quiet:disabled {
  opacity: 0.5;
}

.progress {
  height: 0.5rem;
  margin-top: 1rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-deep);
}

.progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--signal);
  transition: width 0.25s linear;
}

.card .small {
  margin-top: 0.45rem;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.code {
  margin-top: 1rem;
}

.code label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.field {
  display: flex;
  gap: 0.5rem;
}

.field input {
  flex: 1;
  min-width: 0;
  height: 2.9rem;
  padding: 0 1rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--sheet);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field input:focus {
  outline: none;
  border-color: var(--ink);
}

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  flex-wrap: wrap;
  margin: 0.8rem 0.2rem 2.6rem;
  padding: 0.7rem 1rem;
  border-radius: 1rem;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  font-size: 0.95rem;
  animation: pop 0.3s var(--ease) backwards;
}

.notice[hidden] {
  display: none;
}

.link {
  flex: none;
  padding: 0.2rem 0;
  border: 0;
  background: none;
  color: #FFB5A3;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dock {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 0.2rem max(env(safe-area-inset-bottom), 1rem);
  animation: rise 0.7s 0.16s var(--ease) backwards;
}

.side {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 3.2rem;
  padding: 0 1.1rem;
  border: 0;
  border-radius: 999px;
  background: var(--sheet);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-weight: 800;
  font-size: 0.98rem;
  white-space: nowrap;
  transition: transform 0.15s var(--ease), background-color 0.2s, opacity 0.2s;
}

.side svg {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
}

.side:disabled {
  opacity: 0.45;
}

#clear {
  justify-self: start;
}

.copy {
  justify-self: end;
  background: var(--ink);
  color: var(--paper);
  box-shadow: none;
}

.copy.done {
  animation: nudge 0.4s var(--ease);
}

.mic {
  position: relative;
  display: grid;
  place-items: center;
  width: 5.6rem;
  height: 5.6rem;
  margin-top: -2.4rem;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  box-shadow:
    0 0 0 0.4rem var(--paper),
    0 18px 30px -14px rgba(31, 27, 22, 0.6);
  transition: background-color 0.25s var(--ease), transform 0.2s var(--ease);
  animation: land 0.8s 0.25s var(--ease) backwards;
}

.mic:active {
  transform: scale(0.95);
}

.mic svg {
  position: relative;
  z-index: 1;
  width: 2.2rem;
  height: 2.2rem;
}

.mic .glyph-stop,
.mic.on .glyph-mic {
  display: none;
}

.mic.on .glyph-stop {
  display: block;
}

.mic.on {
  background: var(--signal);
  color: var(--on-signal);
}

.mic .halo {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--signal);
  opacity: 0;
  transition: transform 0.12s linear, opacity 0.25s;
}

.mic.on .halo {
  opacity: 0.3;
  transform: scale(calc(1 + var(--level, 0) * 0.85));
}

.mic.on::after {
  content: "";
  position: absolute;
  inset: -0.4rem;
  border-radius: 50%;
  border: 2px solid var(--signal);
  animation: ring 2.2s ease-out infinite;
  pointer-events: none;
}

.mic:disabled:not(.on) {
  background: var(--ink-faint);
  color: var(--sheet);
}

.mic.waiting::before {
  content: "";
  position: absolute;
  inset: -0.4rem;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--signal);
  animation: spin 0.9s linear infinite;
}

.settings {
  width: min(28rem, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: 0 1.4rem max(env(safe-area-inset-bottom), 1.4rem);
  border: 0;
  border-radius: 1.8rem 0 0 1.8rem;
  background: var(--sheet);
  color: var(--ink);
  overscroll-behavior: contain;
}

.settings[open] {
  animation: slide 0.35s var(--ease);
}

.settings::backdrop {
  background: rgba(31, 27, 22, 0.32);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.settings-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(env(safe-area-inset-top), 1.1rem) 0 0.8rem;
  background: var(--sheet);
}

.settings-head h2 {
  font-size: 1.25rem;
}

.group {
  padding: 1.1rem 0;
  border-top: 1.5px dashed var(--line);
}

.group h3 {
  margin-bottom: 0.6rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.group p {
  margin: 0.6rem 0 0;
  font-weight: 600;
}

.choice {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.55rem;
  padding: 0.85rem 1rem;
  border-radius: 1.1rem;
  box-shadow: inset 0 0 0 1.5px var(--line);
  cursor: pointer;
  transition: box-shadow 0.2s, background-color 0.2s;
}

.choice:has(input:checked) {
  background: var(--paper);
  box-shadow: inset 0 0 0 2px var(--ink);
}

.choice input,
.switch input {
  flex: none;
  width: 1.2rem;
  height: 1.2rem;
  margin: 0.15rem 0 0;
  accent-color: var(--signal);
}

.choice b {
  display: block;
  font-weight: 800;
}

.choice small,
.small {
  display: block;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 600;
}

.small a {
  color: var(--signal-deep);
  font-weight: 800;
}

.switch {
  display: flex;
  gap: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.about {
  margin: 0.6rem 0 0;
  color: var(--ink-faint);
  font-size: 0.82rem;
}

body.floating {
  overflow: hidden;
}

body.floating::before {
  opacity: 0.35;
}

.panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
  height: 100vh;
  padding: 0.7rem 0.9rem;
}

.panel .mic {
  width: 4.2rem;
  height: 4.2rem;
  margin: 0;
  box-shadow: none;
  animation: none;
}

.panel .mic svg {
  width: 1.7rem;
  height: 1.7rem;
}

.panel .live {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 1.02rem;
  line-height: 1.35;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  animation: none;
}

.panel .blink {
  display: none;
}

.panel .side {
  width: 3.2rem;
  padding: 0;
  justify-content: center;
}

.panel .side span {
  display: none;
}

.panel .copy.done {
  background: var(--signal);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

@keyframes land {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.8);
  }
}

@keyframes slide {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
}

@keyframes blink {
  50% {
    opacity: 0.15;
  }
}

@keyframes ring {
  from {
    transform: scale(1);
    opacity: 0.7;
  }
  to {
    transform: scale(1.45);
    opacity: 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes nudge {
  40% {
    transform: scale(1.06);
  }
}

@media (min-width: 720px) {
  :root {
    --lh: 2.3rem;
    --pad: 2rem;
    --gutter: 5rem;
  }

  .app {
    padding-top: max(env(safe-area-inset-top), 1.4rem);
  }

  .desk::before {
    content: "";
    position: absolute;
    inset: 0.7rem 0.4rem -0.5rem;
    border-radius: 1.6rem;
    background: var(--paper-deep);
    transform: rotate(-1.2deg);
    box-shadow: 0 20px 40px -30px rgba(70, 48, 26, 0.4);
  }

  textarea,
  .live {
    font-size: 1.45rem;
  }

  .icon span,
  .plan .more {
    display: inline;
  }

  .card {
    margin: 0 1.4rem 1.4rem;
    padding: 1.5rem 1.6rem;
  }

  .mic {
    width: 6.2rem;
    height: 6.2rem;
    margin-top: -2.8rem;
  }
}

@media (max-width: 560px) {
  :root {
    --lh: 1.95rem;
    --pad: 1.05rem;
    --gutter: 2.6rem;
  }

  .word {
    font-size: 1.12rem;
  }

  .mark {
    width: 1.85rem;
    height: 1.85rem;
  }

  #float {
    display: none;
  }

  textarea,
  .live {
    font-size: 1.18rem;
  }

  .dock {
    gap: 0.4rem;
    padding-top: 0.6rem;
  }

  .side {
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
    width: 5.2rem;
    height: auto;
    padding: 0;
    background: none;
    box-shadow: none;
    font-size: 0.8rem;
  }

  .side svg {
    box-sizing: content-box;
    width: 1.2rem;
    height: 1.2rem;
    padding: 0.8rem;
    border-radius: 50%;
    background: var(--sheet);
    box-shadow: inset 0 0 0 1.5px var(--line);
  }

  #clear,
  .copy {
    justify-self: center;
  }

  .copy {
    background: none;
    color: var(--ink);
  }

  .copy svg {
    background: var(--ink);
    color: var(--paper);
    box-shadow: none;
  }

  .copy.done svg {
    background: var(--signal);
  }

  .mic {
    margin-top: -2.2rem;
  }

  .settings {
    width: 100vw;
    height: auto;
    max-height: 90dvh;
    margin: auto 0 0;
    border-radius: 1.8rem 1.8rem 0 0;
  }

  .settings[open] {
    animation-name: lift;
  }

  .settings-head {
    padding-top: 1.1rem;
  }
}

@media (max-width: 380px) {
  .plan {
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
  }
}

@keyframes lift {
  from {
    transform: translateY(60px);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
