:root {
  color-scheme: only light;
  --bg-1: #f6f1e8;
  --bg-2: #e9eef9;
  --panel: rgba(255, 250, 242, 0.88);
  --ink: #20303d;
  --muted: #66717d;
  --line: rgba(75, 96, 117, 0.18);
  --accent: #1f6f78;
  --accent-deep: #16444c;
  --gold: #d9922e;
  --berry: #7b466f;
  --shadow: 0 24px 48px rgba(34, 44, 58, 0.14);
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(31, 111, 120, 0.16), transparent 32%),
    radial-gradient(circle at top right, rgba(123, 70, 111, 0.14), transparent 30%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 48%, #efe3d0 100%);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.panel-heading h2 {
  margin-bottom: 16px;
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(34, 44, 58, 0.16);
}

button:focus-visible,
textarea:focus-visible,
.cell:focus-visible {
  outline: 3px solid rgba(31, 111, 120, 0.3);
  outline-offset: 2px;
}

.hero,
.layout {
  padding-left: 5vw;
  padding-right: 5vw;
}

.hero {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr);
  padding-top: 42px;
  padding-bottom: 18px;
}

.hero-copy,
.hero-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.hero-copy {
  padding: 34px;
  position: relative;
  overflow: hidden;
}

.hero-copy::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -70px;
  bottom: -100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 146, 46, 0.24), transparent 70%);
}

.hero-card,
.panel {
  padding: 24px;
}

.eyebrow,
.section-tag,
.logic-label,
.status-label,
.summary-label,
.step-tag {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-deep);
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 0.96;
  max-width: 11ch;
}

.lede,
.panel-heading p:last-child,
.hero-card p,
.status-text,
.hint-box,
.summary-empty {
  color: var(--muted);
}

.lede {
  margin: 18px 0 0;
  max-width: 62ch;
  line-height: 1.7;
  font-size: 1.05rem;
}

.hero-actions,
.mini-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-actions {
  margin-top: 28px;
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
}

.secondary,
.ghost {
  background: #efe4d5;
  color: var(--ink);
}

.status-card {
  margin-top: 18px;
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(31, 111, 120, 0.1), rgba(217, 146, 46, 0.16));
}

.status-value {
  margin: 0;
  font-weight: 800;
}

.layout {
  display: grid;
  gap: 24px;
  padding-bottom: 56px;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(270px, 0.82fr);
  grid-template-areas:
    "simulator algorithm progress"
    "reflection reflection progress";
}

.simulator-panel { grid-area: simulator; }
.algorithm-panel { grid-area: algorithm; }
.reflection-panel { grid-area: reflection; }
.progress-panel { grid-area: progress; position: sticky; top: 18px; align-self: start; }

.simulator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.board-wrap {
  min-width: 0;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(234, 240, 248, 0.86));
}

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 10px;
}

.cell {
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  border: 1px solid rgba(22, 68, 76, 0.15);
  background: linear-gradient(180deg, #ffffff, #f1eee8);
  color: var(--accent-deep);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  box-shadow: inset 0 -6px 18px rgba(32, 48, 61, 0.06);
}

.cell.player-o {
  color: var(--berry);
}

.cell.paper-x {
  color: var(--accent);
}

.cell:disabled {
  cursor: default;
}

.status-text {
  margin: 16px 0 0;
  line-height: 1.6;
}

.logic-card {
  min-width: 0;
  padding: 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(248, 240, 226, 0.9), rgba(255, 252, 247, 0.92));
  border: 1px solid rgba(217, 146, 46, 0.18);
}

.logic-card h3 {
  margin-bottom: 10px;
}

.hint-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(31, 111, 120, 0.08);
  line-height: 1.5;
}

.step-list {
  display: grid;
  gap: 14px;
}

.step-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(31, 111, 120, 0.12);
  transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.step-card.active {
  transform: translateX(4px);
  border-color: rgba(31, 111, 120, 0.35);
  background: linear-gradient(135deg, rgba(31, 111, 120, 0.12), rgba(255, 255, 255, 0.92));
}

.logic-block {
  display: grid;
  gap: 8px;
  margin-top: 6px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(243, 247, 250, 0.82);
  font-family: "Courier New", "SFMono-Regular", monospace;
  font-size: 0.97rem;
  line-height: 1.55;
}

.logic-block p {
  margin: 0;
}

.logic-keyword {
  display: inline-block;
  min-width: 7ch;
  color: var(--accent-deep);
  font-weight: 800;
}

.logic-indent {
  padding-left: 20px;
}

.logic-indent-2 {
  padding-left: 40px;
}

.field-label {
  display: block;
  margin-top: 18px;
  margin-bottom: 8px;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border-radius: 20px;
  border: 1px solid rgba(75, 96, 117, 0.18);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  line-height: 1.5;
}

.checklist {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 12px;
}

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

.checklist li.done {
  color: var(--accent-deep);
  font-weight: 700;
}

.summary-box {
  margin-top: 22px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
}

.summary-preview {
  line-height: 1.6;
  color: var(--muted);
}

.summary-preview p {
  margin: 0 0 10px;
}

.summary-preview p:last-child {
  margin-bottom: 0;
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "simulator algorithm"
      "reflection reflection"
      "progress progress";
  }

  .progress-panel {
    position: static;
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "simulator"
      "algorithm"
      "reflection"
      "progress";
  }

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

@media (max-width: 520px) {
  .hero,
  .layout {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .board {
    gap: 8px;
  }

  .cell {
    border-radius: 18px;
  }
}
