:root {
  --bg: #fff8ed;
  --surface: #ffffff;
  --surface-soft: #fff3d8;
  --primary: #f97316;
  --primary-dark: #c2410c;
  --primary-soft: #fed7aa;
  --blue: #38bdf8;
  --blue-soft: #e0f2fe;
  --yellow: #facc15;
  --green: #22c55e;
  --ink: #253043;
  --muted: #6b7280;
  --line: #f3d5ab;
  --danger: #b45309;
  --shadow: 0 12px 34px rgba(154, 92, 24, 0.13);
  --radius: 22px;
  --tap: 48px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    linear-gradient(180deg, #fff6e7 0%, #fef9ef 45%, #eef8ff 100%);
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 96px;
}

.loading-screen,
.login-screen {
  min-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.loading-screen {
  align-items: center;
  color: var(--muted);
}

.loading-ball {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 46%, rgba(90, 50, 18, 0.55) 47%, rgba(90, 50, 18, 0.55) 53%, transparent 54%),
    linear-gradient(0deg, transparent 46%, rgba(90, 50, 18, 0.45) 47%, rgba(90, 50, 18, 0.45) 53%, transparent 54%),
    radial-gradient(circle at 35% 30%, #ffb45f 0 18%, #f97316 19% 100%);
  box-shadow: 0 8px 20px rgba(249, 115, 22, 0.28);
  animation: bounce 900ms ease-in-out infinite;
}

.login-card,
.panel,
.record-card,
.summary-card,
.empty-state {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(243, 213, 171, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-card {
  padding: 22px;
}

.brand-lockup {
  display: grid;
  gap: 8px;
}

.eyebrow {
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #0369a1;
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 8vw, 46px);
  line-height: 1.08;
}

h2 {
  font-size: 24px;
  line-height: 1.2;
}

h3 {
  font-size: 18px;
  line-height: 1.3;
}

.lead {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.hero {
  display: grid;
  gap: 14px;
}

.hero-image {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid #fde5ba;
  box-shadow: var(--shadow);
  background: #fff6df;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 16px;
}

.topbar-title {
  display: grid;
  gap: 2px;
}

.topbar-title strong {
  font-size: 18px;
}

.topbar-title span {
  color: var(--muted);
  font-size: 13px;
}

.stack {
  display: grid;
  gap: 16px;
}

.panel {
  padding: 18px;
}

.panel-soft {
  background: linear-gradient(180deg, #fff8e8, #fff);
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 92px;
  padding: 14px;
  border-radius: 18px;
  background: #fff8eb;
  border: 1px solid #fde2b8;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  line-height: 1.15;
}

.actions {
  display: grid;
  gap: 10px;
}

.button {
  min-height: var(--tap);
  border: 0;
  border-radius: 16px;
  padding: 13px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #f3d5ab;
  font-weight: 800;
  text-decoration: none;
}

.button-primary {
  color: #fff;
  background: linear-gradient(180deg, #fb923c, #f97316);
  border-color: #ea580c;
  box-shadow: 0 10px 22px rgba(249, 115, 22, 0.24);
}

.button-blue {
  color: #075985;
  background: var(--blue-soft);
  border-color: #bae6fd;
}

.button-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--primary-dark);
  box-shadow: none;
}

.button-danger {
  color: var(--danger);
  background: #fff7ed;
  border-color: #fed7aa;
}

.button-small {
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 14px;
}

.form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 9px;
}

.field label,
.field-label {
  font-weight: 850;
}

.field-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.input,
.textarea {
  width: 100%;
  border: 1px solid #f1d3a3;
  border-radius: 16px;
  background: #fffdf8;
  color: var(--ink);
  outline: none;
}

.input {
  min-height: var(--tap);
  padding: 12px 14px;
}

.textarea {
  min-height: 112px;
  padding: 14px;
  resize: vertical;
  line-height: 1.65;
}

.input:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.14);
}

.rating {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.rating-button {
  min-width: 0;
  min-height: 50px;
  border: 1px solid #f3d5ab;
  border-radius: 14px;
  background: #fffaf0;
  color: var(--muted);
  font-weight: 850;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.rating-button.is-selected {
  color: #7c2d12;
  background: var(--primary-soft);
  border-color: var(--primary);
  transform: translateY(-2px) scale(1.03);
}

.ball-mark {
  width: 22px;
  height: 22px;
  display: inline-block;
  border-radius: 50%;
  vertical-align: middle;
  background:
    linear-gradient(90deg, transparent 46%, rgba(90, 50, 18, 0.45) 47%, rgba(90, 50, 18, 0.45) 53%, transparent 54%),
    linear-gradient(0deg, transparent 46%, rgba(90, 50, 18, 0.38) 47%, rgba(90, 50, 18, 0.38) 53%, transparent 54%),
    radial-gradient(circle at 35% 30%, #ffb45f 0 20%, #f97316 21% 100%);
}

.range-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.range-value {
  width: 52px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-size: 20px;
  font-weight: 900;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.choice {
  min-height: 50px;
  border: 1px solid #f3d5ab;
  border-radius: 15px;
  background: #fffdf8;
  color: var(--ink);
  padding: 10px;
  font-weight: 750;
}

.choice.is-selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: #075985;
}

.record-card {
  padding: 16px;
  display: grid;
  gap: 12px;
  animation: liftIn 260ms ease both;
}

.record-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.record-head strong {
  font-size: 18px;
}

.record-head span {
  color: var(--muted);
  font-size: 13px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  padding: 6px 9px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  font-size: 12px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.divider {
  height: 1px;
  background: #f6dfbd;
  margin: 2px 0;
}

.nav {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 720px);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(243, 213, 171, 0.9);
  box-shadow: 0 18px 48px rgba(61, 42, 23, 0.18);
  backdrop-filter: blur(16px);
  z-index: 20;
}

.nav button {
  min-height: 48px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.nav button.is-active {
  color: #9a3412;
  background: var(--primary-soft);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  width: min(calc(100% - 32px), 520px);
  padding: 13px 16px;
  border-radius: 16px;
  background: #1f2937;
  color: #fff;
  text-align: center;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.2);
  z-index: 30;
}

.summary-card {
  padding: 16px;
}

.bar-list {
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: 88px 1fr 32px;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #f8e4c5;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--yellow), var(--primary));
}

.empty-state {
  padding: 22px;
  text-align: center;
}

.detail-list {
  display: grid;
  gap: 10px;
}

.detail-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 16px;
  background: #fffaf0;
  border: 1px solid #f8e0bb;
}

.detail-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-item strong {
  font-weight: 750;
  line-height: 1.55;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes liftIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 680px) {
  .app-shell {
    padding-top: 26px;
  }

  .home-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 18px;
    align-items: start;
  }

  .actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .rating {
    gap: 6px;
  }

  .rating-button {
    min-height: 46px;
    font-size: 14px;
  }

  .choice-grid,
  .grid-two {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
