:root {
  color-scheme: light;
  --bg: #f5f5f2;
  --ink: #111111;
  --muted: #777770;
  --line: #d8d8d1;
  --panel: #ffffff;
  --active: #111111;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: Helvetica, Arial, system-ui, sans-serif; }
body { min-height: 100vh; }
button { font: inherit; }

.app {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1 { margin: 0; font-size: 22px; letter-spacing: .08em; font-weight: 700; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 13px; letter-spacing: .04em; }
.text-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 0 8px 12px;
  min-height: 44px;
}

.canvas-wrap {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  min-height: 390px;
}

#traceCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.empty-state {
  position: absolute;
  inset: 0 20px 42px;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
  color: var(--muted);
  gap: 8px;
}
.empty-state span { font-size: 17px; }
.empty-state small { font-size: 12px; }

.status-row {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  pointer-events: none;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b8b8b1;
}
.status-dot.live { background: #111111; }

.controls { padding-top: 18px; }
.hold-btn {
  width: 100%;
  min-height: 92px;
  border-radius: 22px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: white;
  display: grid;
  place-content: center;
  gap: 5px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.hold-btn.recording { background: white; color: var(--ink); }
.hold-main { font-weight: 700; letter-spacing: .08em; font-size: 18px; }
.hold-sub { font-size: 11px; opacity: .65; letter-spacing: .04em; }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.secondary-btn {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}
.secondary-btn:disabled { color: #b5b5af; }
.hint { margin: 12px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }

@media (max-width: 420px) {
  .app { padding-left: 14px; padding-right: 14px; }
  .canvas-wrap { border-radius: 18px; min-height: 360px; }
  .hold-btn { border-radius: 18px; min-height: 88px; }
}
