﻿:root {
  --bg: #f7f6ef;
  --ink: #1c2a3a;
  --panel: #ffffffde;
  --line: #a8c2d8;
  --brand: #ff6b6b;
  --brand-deep: #d94848;
  --accent: #1aa6b7;
  --accent-2: #ffd166;
  --success: #2a9d8f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 20%, #ffe9c8 0%, transparent 35%),
    radial-gradient(circle at 80% 10%, #c9f3ff 0%, transparent 38%),
    radial-gradient(circle at 50% 80%, #f8d9ff 0%, transparent 34%),
    var(--bg);
  color: var(--ink);
  font-family: "Baloo 2", "Trebuchet MS", "Comic Sans MS", cursive;
  line-height: 1.4;
  position: relative;
}

.background-shape {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  opacity: 0.4;
}

.shape-a {
  width: 220px;
  height: 220px;
  top: -40px;
  right: -50px;
  background: linear-gradient(130deg, #8be9ff, #66c7f4);
  border-radius: 45% 55% 60% 40%;
  animation: wobble 9s ease-in-out infinite;
}

.shape-b {
  width: 180px;
  height: 180px;
  bottom: 10px;
  left: -30px;
  background: linear-gradient(140deg, #ffd166, #ff9f6e);
  border-radius: 58% 42% 38% 62%;
  animation: wobble 7s ease-in-out infinite reverse;
}

@keyframes wobble {
  0%,
  100% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(8deg) scale(1.06);
  }
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 14px 28px;
}

.hero {
  text-align: center;
  padding: 10px 4px 20px;
}

.hero h1 {
  margin: 0;
  font-family: "Atma", "Baloo 2", cursive;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  letter-spacing: 0.02em;
  color: #12313c;
}

.hero p {
  margin: 8px auto 0;
  max-width: 760px;
  font-size: 1.05rem;
}

.panel {
  background: var(--panel);
  border: 2px solid #ffffff;
  border-radius: 18px;
  box-shadow: 0 10px 26px #1b27350f;
  backdrop-filter: blur(1px);
}

.controls-panel {
  padding: 18px;
  margin-bottom: 18px;
}

.controls-panel h2 {
  margin: 0 0 12px;
  color: #224056;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 1rem;
}

input,
select,
button {
  font: inherit;
}

input[type="text"],
input[type="number"],
select {
  border: 2px solid #d4e4f0;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}

input:focus,
select:focus {
  outline: 3px solid #8be9ff;
  border-color: #3bb8d4;
}

.subgroup {
  margin-top: 14px;
}

.subgroup-title {
  margin: 0 0 8px;
  font-weight: 700;
  color: #1c405b;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips label {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  background: #f3fbff;
  border: 1px solid #d7ecfa;
  border-radius: 999px;
  padding: 5px 12px;
}

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

.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: linear-gradient(120deg, var(--brand), #ff8a5b);
  color: white;
  box-shadow: 0 8px 20px #ff6b6b4a;
}

.btn.secondary {
  background: linear-gradient(120deg, var(--accent), #2dbbc2);
  color: white;
  box-shadow: 0 8px 20px #1aa6b73a;
}

.worksheet {
  padding: 18px;
}

.worksheet-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 3px dashed #c4d9ec;
  padding-bottom: 10px;
}

.worksheet-header h2 {
  margin: 0;
  color: #183851;
}

.meta {
  margin: 4px 0 0;
  color: #33506a;
}

.identity {
  min-width: 220px;
  background: #f5fbff;
  border: 1px solid #d7ecfa;
  border-radius: 12px;
  padding: 8px 10px;
}

.identity p {
  margin: 2px 0;
}

.section {
  margin-top: 14px;
  border: 1px solid #dceaf5;
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  break-inside: avoid;
}

.section h3 {
  margin: 0 0 8px;
  color: #17435e;
}

.section h4 {
  margin: 10px 0 8px;
  color: #17435e;
}

.section .hint {
  margin: 0 0 8px;
  color: #345;
  font-size: 0.97rem;
}

.trace-grid {
  display: grid;
  gap: 12px;
}

.trace-card {
  border: 1px solid #d9e8f3;
  border-radius: 12px;
  padding: 8px;
  background: #fbfdff;
}

.trace-title {
  margin: 0 0 4px;
  font-weight: 700;
  color: #194a68;
}

.trace-card svg {
  width: 100%;
  height: auto;
  border-radius: 10px;
  background:
    linear-gradient(white, white) padding-box,
    repeating-linear-gradient(
      90deg,
      #f2f8fd,
      #f2f8fd 24px,
      #ffffff 24px,
      #ffffff 48px
    );
  border: 1px dashed #cee4f4;
}

.trace-card svg .trace-number {
  font-size: 16px;
  font-weight: 700;
}

.trace-card svg .trace-start,
.trace-card svg .trace-end {
  font-size: 15px;
  font-weight: 700;
}

.model-grid,
.story-block,
.flowers,
.family-grid {
  display: grid;
  gap: 12px;
}

.model-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.model-card,
.story-item,
.family-card,
.flower-template {
  border: 1px solid #d5e7f5;
  border-radius: 12px;
  padding: 10px;
  background: #fafdff;
}

.model-card p,
.story-item p,
.family-card p {
  margin: 0 0 8px;
}

.model-figure {
  min-height: 120px;
  border: 1px dashed #b5d1e5;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.group-model {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
}

.group-box {
  border: 1px solid #cfe0ef;
  border-radius: 10px;
  padding: 8px;
  background: #fbfdff;
}

.group-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #184664;
}

.dot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dot {
  width: 12px;
  height: 12px;
  border: 2px solid #6288a4;
  border-radius: 50%;
  display: inline-block;
}

.array-model {
  display: grid;
  gap: 6px;
  align-items: center;
}

.array-cell {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid #6c93af;
  border-radius: 4px;
  background: #fff;
}

.drill-grid,
.equation-grid {
  columns: 2;
  column-gap: 18px;
}

.drill-grid p,
.equation-grid p {
  margin: 0 0 8px;
  break-inside: avoid;
  font-size: 1.02rem;
}

.story-steps {
  display: grid;
  gap: 8px;
}

.thinking-box {
  border: 1px solid #d8e8f4;
  border-radius: 10px;
  padding: 8px 10px;
  background: #f6fbff;
}

.thinking-title {
  margin: 0 0 6px;
  font-weight: 700;
  color: #17435e;
}

.thinking-line {
  margin: 0;
  padding: 5px 0;
  border-bottom: 1px dashed #c2d8e8;
  font-size: 0.96rem;
}

.thinking-line:last-child {
  border-bottom: 0;
}

.work-line {
  margin: 0;
  padding: 6px 0;
  border-bottom: 1px dashed #9ebcd3;
}

.draw-box {
  min-height: 90px;
  border: 1px dashed #88abc5;
  border-radius: 8px;
  background:
    repeating-linear-gradient(
      0deg,
      #ffffff,
      #ffffff 20px,
      #f6fbff 20px,
      #f6fbff 40px
    );
}

.table-wrap {
  overflow-x: auto;
}

.fact-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 640px;
}

.fact-table th,
.fact-table td {
  border: 1px solid #cde0ef;
  text-align: center;
  min-width: 38px;
  height: 32px;
  font-size: 0.95rem;
}

.fact-table th {
  background: #edf6fc;
  color: #184664;
}

.fact-table td.blank {
  background: #fff8cc;
  font-weight: 700;
  color: #8a6d00;
}

.flowers {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.flower-title {
  margin: 0 0 6px;
  text-align: center;
  color: #183851;
  font-weight: 700;
}

.flower-figure {
  margin: 0;
}

.flower-svg {
  width: 100%;
  height: auto;
  display: block;
}

.flower-svg .outer-petal,
.flower-svg .inner-petal,
.flower-svg .flower-core {
  fill: #ffffff;
  stroke: #1d1d1d;
}

.flower-svg .outer-petal {
  stroke-width: 2.1;
}

.flower-svg .inner-petal {
  stroke-width: 1.7;
}

.flower-svg .flower-core {
  stroke-width: 2;
}

.flower-svg .inner-label {
  font-size: 17px;
  font-weight: 700;
  fill: #000;
}

.flower-svg .inner-label.division-label {
  font-size: 14px;
}

.flower-svg .outer-blank {
  stroke: #111;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.flower-svg .flower-core-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  fill: #222;
}

.flower-svg .flower-core-value {
  font-size: 26px;
  font-weight: 700;
  fill: #000;
}

.answers {
  margin-top: 14px;
  border-top: 3px dotted #c7dcec;
  padding-top: 12px;
}

.answers p {
  margin: 4px 0;
  font-size: 0.95rem;
}

.fade-in {
  animation: fadeIn 0.35s ease;
}

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

@media (max-width: 760px) {
  .worksheet-header {
    flex-direction: column;
  }

  .identity {
    min-width: auto;
  }

  .drill-grid,
  .equation-grid {
    columns: 1;
  }

  .model-grid,
  .flowers,
  .family-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4;
    margin: 10mm;
  }

  body {
    background: white;
    color: black;
    font-family: "Times New Roman", serif;
  }

  .no-print,
  .background-shape {
    display: none !important;
  }

  .page {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .panel,
  .section,
  .trace-card,
  .model-card,
  .story-item,
  .flower-template,
  .family-card,
  .identity {
    box-shadow: none;
    backdrop-filter: none;
    border-color: #777;
    background: white;
  }

  .worksheet {
    padding: 0;
  }

  .draw-box,
  .model-figure,
  .group-box,
  .array-cell,
  .dot {
    background: white;
    border-color: #555;
  }

  .trace-card svg .trace-number {
    font-size: 14px !important;
  }

  .flower-svg .outer-petal,
  .flower-svg .inner-petal,
  .flower-svg .flower-core,
  .flower-svg .outer-blank,
  .flower-svg .inner-label,
  .flower-svg .flower-core-label,
  .flower-svg .flower-core-value {
    fill: #fff;
    stroke: #000;
    color: #000;
  }

  .flower-svg .inner-label,
  .flower-svg .flower-core-label,
  .flower-svg .flower-core-value {
    fill: #000;
    stroke: none;
  }
}

