:root {
  color-scheme: light;
  --bg: #fff7ed;
  --panel: rgba(255, 255, 255, 0.82);
  --text: #24140c;
  --muted: #7c5f4d;
  --line: rgba(124, 95, 77, 0.18);
  --accent: #f97316;
  --accent-strong: #ea580c;
  --pink: #ec4899;
  --green: #16a34a;
  --shadow: 0 18px 50px rgba(124, 45, 18, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(251, 146, 60, 0.25), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(236, 72, 153, 0.18), transparent 26rem),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
textarea {
  font: inherit;
}

.shell {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 22px 4px 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 9vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.06em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

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

.score-card {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 237, 213, 0.92));
  box-shadow: var(--shadow);
}

.score-card span {
  display: block;
  color: var(--accent-strong);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
}

.score-card small {
  color: var(--muted);
}

.panel {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.action-list,
.log-list {
  display: grid;
  gap: 12px;
}

.action-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
}

.action-card.done {
  border-color: rgba(22, 163, 74, 0.38);
  background: rgba(240, 253, 244, 0.78);
}

.action-card.priority {
  border-color: rgba(236, 72, 153, 0.36);
  background: rgba(253, 242, 248, 0.78);
}

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

.action-title {
  margin-bottom: 8px;
  font-size: 1.08rem;
  font-weight: 760;
}

.badge {
  align-self: flex-start;
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: #ffedd5;
  color: #9a3412;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge.done {
  background: #dcfce7;
  color: #166534;
}

.badge.priority {
  background: #fce7f3;
  color: #9d174d;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.action-card p {
  margin-bottom: 10px;
}

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

.primary,
.ghost,
.rank-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 720;
}

.primary {
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  color: white;
}

.ghost {
  padding: 10px 13px;
  background: rgba(255, 237, 213, 0.72);
  color: #9a3412;
}

.rank-button {
  width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  font-size: 1.25rem;
}

.rank-button.up {
  background: #fce7f3;
  color: #9d174d;
}

.rank-button.down {
  background: #f3f4f6;
  color: #4b5563;
}

.panel-note {
  margin-bottom: 14px;
  line-height: 1.55;
}

.empty {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 247, 237, 0.85);
  color: var(--muted);
}

.learning-summary {
  display: grid;
  gap: 12px;
}

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

.learning-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 247, 237, 0.82);
}

.learning-grid strong,
.learning-grid span {
  display: block;
}

.learning-grid strong {
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 1.05rem;
}

.learning-grid span {
  color: var(--muted);
  font-size: 0.82rem;
}

.log-item {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 247, 237, 0.85);
  border: 1px solid var(--line);
}

.log-item strong {
  display: block;
  margin-bottom: 4px;
}

.context-body {
  display: grid;
  gap: 12px;
  line-height: 1.65;
}

.context-body p {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 247, 237, 0.82);
}

.dialog {
  width: min(560px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: white;
  color: var(--text);
  box-shadow: 0 24px 80px rgba(67, 20, 7, 0.3);
}

.dialog::backdrop {
  background: rgba(36, 20, 12, 0.42);
  backdrop-filter: blur(4px);
}

.dialog form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fffaf5;
  color: var(--text);
  outline-color: var(--accent);
}

textarea {
  resize: vertical;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 20;
  transform: translate(-50%, 120px);
  max-width: min(520px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(36, 20, 12, 0.92);
  color: white;
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.confetti {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 15;
}

.piece {
  position: absolute;
  top: -18px;
  width: 10px;
  height: 16px;
  border-radius: 4px;
  animation: fall 1300ms cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

@keyframes fall {
  to {
    transform: translate3d(var(--dx), 110vh, 0) rotate(540deg);
    opacity: 0.8;
  }
}

@media (max-width: 560px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .score-card {
    width: 100%;
    height: 82px;
    grid-template-columns: auto auto;
    justify-content: center;
    gap: 10px;
  }
}
