:root {
  --bg: #0f1410;
  --bg-elevated: #1a221c;
  --bg-soft: #243028;
  --text: #e8f0ea;
  --muted: #9aafa0;
  --accent: #7cb892;
  --accent-dim: #4a7a5c;
  --danger: #c76b6b;
  --danger-soft: #5a3030;
  --success: #6bc48a;
  --success-soft: #1e3d2a;
  --border: #2e3d32;
  --radius: 16px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(1200px 600px at 50% -10%, #1c2a22 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--font);
}

body {
  line-height: 1.5;
}

a {
  color: var(--accent);
}

.shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

/* Multi-panel app shell */
.app-layout {
  max-width: 920px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0.85rem 0.85rem calc(4.75rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
}

.panel-host {
  flex: 1;
  min-height: 0;
}

.panel {
  display: none;
  animation: panel-in 0.18s ease;
}

.panel.active {
  display: block;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.1rem;
  padding: 0.45rem 0.25rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 40;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  padding: 0.35rem 0.15rem;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  cursor: pointer;
}

.nav-item .nav-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.nav-item.active {
  color: var(--text);
  background: var(--bg-soft);
}

.nav-item:hover {
  color: var(--text);
}

.timer-card {
  text-align: center;
}

.timer-card .btn-row {
  justify-content: center;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.card-head h2 {
  margin: 0;
}

button.linkish,
.linkish {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 0.85rem;
  padding: 0.25rem 0.35rem;
  cursor: pointer;
}

.stats-grid.compact {
  grid-template-columns: repeat(3, 1fr);
}

.user-email {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .topbar {
    flex-wrap: wrap;
  }
  .user-email {
    display: none;
  }
  .tagline {
    font-size: 0.8rem;
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  border-radius: 22%;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.brand .tagline {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.auth-icon {
  border-radius: 22%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.goal-banner {
  position: sticky;
  top: 0.5rem;
  z-index: 20;
  margin-bottom: 1rem;
}

.goal-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid #4a8a62;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--success-soft) 90%, transparent),
    color-mix(in srgb, var(--bg-elevated) 85%, transparent)
  );
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.goal-banner-text {
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--success);
}

.goal-banner.playing .goal-banner-text {
  animation: pulse-soft 1.8s ease-in-out infinite;
}

@keyframes pulse-soft {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.65;
  }
}

.version-pill {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  background: var(--bg-elevated);
}

.user-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.card {
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  backdrop-filter: blur(8px);
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.timer-display {
  font-family: var(--mono);
  font-size: clamp(2.8rem, 10vw, 4.5rem);
  font-weight: 500;
  text-align: center;
  letter-spacing: 0.06em;
  margin: 0.5rem 0 1rem;
  color: var(--text);
}

.timer-sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  min-height: 1.2em;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

button,
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

button:hover,
.btn:hover {
  border-color: var(--accent-dim);
  background: #2c3c32;
}

button:active {
  transform: scale(0.98);
}

button.primary {
  background: linear-gradient(180deg, #5fa87a, #3f7a56);
  border-color: #4a8a62;
  color: #f4fff7;
  font-weight: 600;
  min-width: 10rem;
}

button.primary:hover {
  background: linear-gradient(180deg, #6fba8a, #4a8a62);
}

button.danger {
  background: linear-gradient(180deg, #a85a5a, #7a3f3f);
  border-color: #8a4a4a;
  color: #fff5f5;
  font-weight: 600;
  min-width: 10rem;
}

button.ghost {
  background: transparent;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
}

.stat .label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat .value {
  font-family: var(--mono);
  font-size: 1.35rem;
  margin-top: 0.25rem;
}

.chart {
  width: 100%;
  overflow-x: auto;
}

.chart-svg {
  width: 100%;
  min-width: 480px;
  height: auto;
  display: block;
}

.day-bar {
  stroke: none;
}

.day-bar.met {
  fill: var(--success);
}

.day-bar.miss {
  fill: var(--danger);
}

.day-bar.empty {
  fill: #2a3530;
}

.segment-bar.timed {
  fill: #8fd4a8;
}

.segment-bar.manual {
  fill: #c9b36a;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

.legend span::before {
  content: "";
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  margin-right: 0.35rem;
  vertical-align: -1px;
}

.legend .met::before {
  background: var(--success);
}
.legend .miss::before {
  background: var(--danger);
}
.legend .seg-timed::before {
  background: #8fd4a8;
}
.legend .seg-manual::before {
  background: #c9b36a;
}

.form-grid {
  display: grid;
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 0.65rem 0.8rem;
  font-size: 1rem;
}

input:focus {
  outline: 2px solid var(--accent-dim);
  border-color: var(--accent);
}

.auth-wrap {
  max-width: 400px;
  margin: 4rem auto;
  padding: 0 1rem;
}

.auth-wrap .card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

.auth-wrap .hint {
  color: var(--muted);
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tabs button {
  flex: 1;
  border-radius: 10px;
}

.tabs button.active {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.msg {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--danger);
  min-height: 1.2em;
}

.msg.ok {
  color: var(--success);
}

.hidden {
  display: none !important;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.list li:last-child {
  border-bottom: none;
}

.list .muted {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2rem;
}

.subhead {
  margin: 1rem 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mood-picker {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.mood-prompt {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.mood-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.mood-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 4.2rem;
  padding: 0.55rem 0.45rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 0.72rem;
}

.mood-btn .emo {
  font-size: 1.55rem;
  line-height: 1.2;
}

.mood-btn:hover,
.mood-btn.selected {
  border-color: var(--accent);
  background: #2c3c32;
}

.date-range-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 520px) {
  .date-range-row {
    grid-template-columns: 1fr;
  }
}

.field-hint {
  margin: -0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.bowl-list {
  display: grid;
  gap: 0.55rem;
}

.bowl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}

.bowl-row.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

.bowl-row .bowl-meta {
  flex: 1;
  min-width: 8rem;
}

.bowl-row .bowl-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.bowl-row .bowl-desc {
  font-size: 0.8rem;
  color: var(--muted);
}

.bowl-row button {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
}

.list .actions {
  display: flex;
  gap: 0.4rem;
}

.list .actions button {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
}

.chart-mood-label {
  font-size: 11px;
}

.survey-kind-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.75rem 0 1rem;
}

.survey-kind-btn {
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--muted);
}

.survey-kind-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

.survey-title {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.survey-form {
  display: grid;
  gap: 1rem;
}

.survey-q {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}

.survey-q .deed-tag {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  margin-bottom: 0.4rem;
}

.survey-q .scenario {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  line-height: 1.45;
}

.survey-q label.opt {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.35rem 0;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
}

.survey-q input[type="radio"] {
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.survey-results {
  margin-top: 1.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.bowl-params {
  margin-top: 0.5rem;
}

.bowl-params input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  padding: 0;
  background: transparent;
  border: none;
}
