/* ── Reset & Base ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0a0a0a;
  --surface:    #141414;
  --surface2:   #1e1e1e;
  --border:     #2a2a2a;
  --accent:     #ffffff;
  --accent-dim: #888;
  --danger:     #ff4d4d;
  --text:       #f0f0f0;
  --text-dim:   #666;
  --radius:     20px;
  --radius-sm:  12px;
  --hold-size:  220px;
  --font:       -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

/* ── Screens ────────────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: env(safe-area-inset-top, 16px) 24px env(safe-area-inset-bottom, 24px);
  overflow: hidden;
}
.screen.active { display: flex; }

/* ── Top Bar ────────────────────────────────────────── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 8px;
  flex-shrink: 0;
}

.app-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: lowercase;
  color: var(--accent);
}

.icon-btn {
  width: 40px;
  height: 40px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
  color: var(--text);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { background: var(--border); }
.icon-btn.danger { color: var(--danger); }

/* ── Timer Display ──────────────────────────────────── */
.timer-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-bottom: 24px;
}

.timer-text {
  font-size: clamp(52px, 16vw, 80px);
  font-weight: 200;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  transition: color 0.2s;
  line-height: 1;
}
.timer-text.running { color: #fff; }

.timer-status {
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: lowercase;
  height: 18px;
  transition: opacity 0.3s;
}

/* ── Hold Button ────────────────────────────────────── */
.hold-area {
  display: flex;
  justify-content: center;
  padding: 24px 0 32px;
  flex-shrink: 0;
}

.hold-btn {
  width: var(--hold-size);
  height: var(--hold-size);
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition:
    transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.2s,
    border-color 0.2s,
    box-shadow 0.2s;
  -webkit-user-select: none;
  touch-action: none;
}

.hold-btn::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid transparent;
  transition: border-color 0.2s, inset 0.2s;
}

.hold-btn.pressed {
  transform: scale(0.93);
  background: var(--surface2);
  border-color: #fff3;
  box-shadow: 0 0 60px #ffffff18, 0 0 120px #ffffff08;
}
.hold-btn.pressed::before {
  inset: -14px;
  border-color: #fff1;
}

.hold-btn-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.hold-icon svg {
  width: 42px;
  height: 42px;
  color: var(--accent-dim);
  transition: color 0.2s;
}
.hold-btn.pressed .hold-icon svg { color: #fff; }

.hold-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--text-dim);
  transition: color 0.2s;
}
.hold-btn.pressed .hold-label { color: var(--accent); }

/* Pulsing ring when running */
@keyframes pulse-ring {
  0%   { transform: scale(1);    opacity: 0.4; }
  70%  { transform: scale(1.12); opacity: 0; }
  100% { transform: scale(1.12); opacity: 0; }
}
.hold-btn.pressed::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid #fff;
  animation: pulse-ring 1.5s ease-out infinite;
  pointer-events: none;
}

/* ── Result Panel ───────────────────────────────────── */
.result-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  flex-shrink: 0;
  transition: opacity 0.3s, transform 0.3s;
}
.result-panel.hidden { display: none; }

.result-time {
  font-size: 36px;
  font-weight: 200;
  color: var(--accent);
  margin-bottom: 14px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.note-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
  padding: 12px 14px;
  resize: none;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
  transition: border-color 0.15s;
  line-height: 1.5;
}
.note-input::placeholder { color: var(--text-dim); }
.note-input:focus { border-color: #444; }

.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  flex: 1;
  height: 46px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
  font-family: var(--font);
}
.btn:active { transform: scale(0.97); opacity: 0.85; }

.btn-ghost {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.btn-primary {
  background: #fff;
  color: #000;
}

/* ── Notes Screen ───────────────────────────────────── */
.notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 16px;
  -webkit-overflow-scrolling: touch;
}
.notes-list::-webkit-scrollbar { display: none; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 60%;
  color: var(--text-dim);
  text-align: center;
}
.empty-state svg { width: 40px; height: 40px; opacity: 0.4; }
.empty-state p { font-size: 16px; font-weight: 500; opacity: 0.5; }
.empty-state span { font-size: 13px; opacity: 0.35; }

/* Note card */
.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slide-in 0.25s ease;
}
@keyframes slide-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.note-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.note-duration {
  font-size: 26px;
  font-weight: 200;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  line-height: 1;
}

.note-card-actions {
  display: flex;
  gap: 8px;
}

.card-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s;
}
.card-btn svg { width: 15px; height: 15px; }
.card-btn:active { background: var(--border); }
.card-btn.share { color: #6cb6ff; }
.card-btn.delete { color: var(--danger); }

.note-text {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.5;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}

.note-meta {
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.45;
  letter-spacing: 0.04em;
}

/* ── Toast ──────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #fff;
  color: #000;
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 10px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.02em;
}
.site-footer a {
  color: rgba(255,255,255,0.4);
  text-decoration: none;
}
.site-footer a:hover {
  color: rgba(255,255,255,0.7);
}
.footer-sep {
  margin: 0 6px;
}
