:root {
  font-family: system-ui, "Segoe UI", Arial, sans-serif;
  color: #30304b;
  background: #f7f5fb;
  --violet: #70528f;
  --line: #e4dced;
  --mint: #d6efe7;
  --peach: #ffe3cc;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header {
  display: flex;
  gap: 20px;
  align-items: center;
  background: white;
  border-bottom: 1px solid var(--line);
  padding: 18px max(4vw, 18px);
}
.brand {
  font-weight: 800;
  color: #655080;
  text-decoration: none;
}
header label {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.badge {
  font-size: 0.75rem;
  background: #edf6ef;
  color: #37684c;
  padding: 6px 13px;
  border-radius: 30px;
}
main {
  max-width: 1270px;
  margin: auto;
  padding: 30px 24px;
}
.hero {
  position: relative;
  min-height: 210px;
  padding: 25px 0 30px;
  padding-inline-end: 240px;
  max-width: 100%;
}
.eyebrow {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  color: #7d6698;
}
h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.25;
  margin: 12px 0;
}
p {
  line-height: 1.8;
}
.hero p {
  max-width: 780px;
  color: #686078;
}
.hero-drawing {
  position: absolute;
  inset-inline-end: 15px;
  top: 12px;
  width: 210px;
  height: 190px;
}
.orb {
  position: absolute;
  width: 95px;
  height: 95px;
  border-radius: 30px;
  display: grid;
  place-items: center;
  font-size: 3rem;
  box-shadow: 0 12px 0 #6f54760c;
  animation: bob 5s ease-in-out infinite;
}
.orb.a {
  background: #ffdfb4;
  color: #aa7424;
  top: 0;
  left: 10px;
  transform: rotate(-12deg);
}
.orb.b {
  background: #d5e9df;
  color: #487665;
  top: 10px;
  right: 0;
  animation-delay: -1s;
}
.orb.c {
  background: #e0d4ed;
  color: #755b95;
  bottom: 0;
  left: 5px;
  animation-delay: -2s;
}
.orb.d {
  background: #f6d5df;
  color: #a55c73;
  bottom: -5px;
  right: 0;
  animation-delay: -3s;
}
@keyframes bob {
  50% {
    translate: 0 -6px;
  }
}
nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
}
.tile {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: start;
  min-height: 96px;
  padding: 18px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  position: relative;
  transition:
    translate 0.15s,
    box-shadow 0.15s;
}
.tile:hover {
  translate: 0 -3px;
  box-shadow: 0 8px 22px #58406c11;
}
.tile[aria-current="true"] {
  border-color: #9875bc;
  background: #f0e9f7;
}
.tile .icon {
  width: 43px;
  height: 43px;
  flex-shrink: 0;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--color, #eee6f7);
  font-size: 1.6rem;
}
.tile strong {
  display: block;
  font-size: 0.93rem;
}
.tile small {
  color: #82728c;
  font-size: 0.72rem;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 25px 0 0;
  flex-wrap: wrap;
}
.project-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
button,
select,
input,
textarea {
  font: inherit;
}
button,
select,
.import {
  border: 1px solid #d3c5df;
  border-radius: 11px;
  background: white;
  padding: 10px 14px;
  color: #51405f;
}
button,
.import {
  cursor: pointer;
}
button:hover,
.import:hover {
  background: #f2edf8;
}
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid #af87d2;
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
.primary {
  background: var(--violet);
  color: white;
  font-weight: 700;
}
.primary:hover {
  background: #584073;
}
.import {
  display: inline-block;
}
.import input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.import:focus-within {
  outline: 3px solid #af87d2;
}
#status {
  font-size: 0.9rem;
  color: #795993;
  min-height: 20px;
  margin: 8px 0;
}
#status.error {
  color: #a33650;
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 23px;
  padding: 25px;
  margin: 14px 0;
}
.tool-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}
.tool-head .big-icon {
  font-size: 2.3rem;
  background: var(--color, #f1e6fc);
  padding: 12px;
  border-radius: 20px;
}
.tool-head h2 {
  font-size: 1.7rem;
  margin: 0 0 5px;
}
.tool-head p {
  margin: 0;
  color: #746980;
  font-size: 0.9rem;
}
.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
}
.controls {
  background: #faf8fd;
  border-radius: 17px;
  padding: 18px;
  align-self: start;
}
.controls > label,
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0 0 17px;
  font-size: 0.9rem;
}
label output {
  color: #70528f;
  font-weight: 750;
}
input[type="text"],
input[type="date"],
textarea {
  width: 100%;
  border: 1px solid #d5c9df;
  border-radius: 10px;
  padding: 11px;
  background: white;
  color: #352d43;
}
textarea {
  min-height: 94px;
  resize: vertical;
}
input[type="range"] {
  width: 100%;
  accent-color: #7d5f9a;
}
input[type="checkbox"] {
  accent-color: #7d5f9a;
}
.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.hint,
.note {
  font-size: 0.82rem;
  color: #71647b;
  line-height: 1.8;
}
.note {
  background: #f5eee0;
  border-inline-start: 4px solid #ceab76;
  border-radius: 9px;
  padding: 12px 16px;
}
.result {
  padding: 16px;
  border-radius: 14px;
  background: #ecf5ee;
  border: 1px solid #d5e7da;
  font-size: 1.05rem;
  line-height: 1.7;
}
.result.warn {
  background: #fff3e6;
  border-color: #f0dac2;
}
.blank {
  padding: 42px;
  background: linear-gradient(135deg, #ece4f6, #e5f3ef);
  border-radius: 22px;
  text-align: center;
}
.blank strong {
  font-size: 1.5rem;
}
.visual {
  border: 1px solid #e3deeb;
  border-radius: 18px;
  background: #f8f8fc;
  overflow: hidden;
  position: relative;
  min-width: 0;
}
.visual svg {
  display: block;
  width: 100%;
  height: auto;
}
.stage-node {
  cursor: grab;
  touch-action: none;
}
.stage-node.selected > rect {
  stroke: #9b70bd;
  stroke-width: 3;
  stroke-dasharray: 5 4;
  fill: #ffffff20;
}
.stage-node > rect {
  fill: transparent;
  stroke: transparent;
}
.stage-node:focus {
  outline: none;
}
.stage-node:focus > rect {
  stroke: #775194;
  stroke-width: 3;
}
.story-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
}
.story-output {
  background: #fcfaf5;
  border-radius: 15px;
  padding: 25px;
  min-height: 180px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 2;
}
.sequence-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 12px;
}
.sequence-list li {
  display: flex;
  align-items: center;
  gap: 15px;
  background: #f6f1fa;
  border: 1px solid #e2d9ec;
  padding: 13px 18px;
  border-radius: 14px;
}
.sequence-list .number {
  background: white;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.sequence-list .move {
  margin-inline-start: auto;
  display: flex;
  gap: 7px;
}
.sequence-list .move button {
  padding: 6px 11px;
}
.fraction-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.fraction-card {
  background: #f9f6fc;
  border-radius: 19px;
  padding: 20px;
  text-align: center;
}
.fraction-card svg {
  width: 100%;
  max-width: 250px;
}
.fraction-card .fraction {
  font-size: 1.8rem;
  font-weight: 800;
}
.fraction-card input {
  accent-color: #b88564;
}
.fraction-card label {
  display: block;
  margin: 10px;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.product {
  border-radius: 17px;
  border: 1px solid var(--line);
  padding: 17px;
  background: #fcfaf7;
  text-align: center;
}
.product svg {
  width: 75px;
  height: 75px;
  display: block;
  margin: 0 auto 8px;
}
.product label {
  display: block;
}
.product select {
  margin-top: 10px;
  max-width: 100%;
}
.bill {
  margin-top: 17px;
  background: #f6f1fb;
  border-radius: 14px;
  padding: 18px;
}
.bill p {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 7px 0;
}
.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 17px;
}
.subtabs [aria-pressed="true"] {
  background: #eae0f3;
  border-color: #9f7abc;
}
.measuring svg {
  max-height: 450px;
}
.clock svg {
  max-height: 440px;
}
.grid-board {
  max-width: 650px;
  margin: auto;
  direction: ltr;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
  background: #dcd5e4;
  padding: 3px;
  border-radius: 6px;
}
.grid-board button {
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: white;
}
.grid-board button:nth-child(12n + 6) {
  border-right: 3px dashed #b184c8;
}
.grid-board button.active {
  background: var(--paint, #9674b0);
}
.circuit-wire {
  fill: none;
  stroke: #8c90a5;
  stroke-width: 8;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.current-flow {
  fill: none;
  stroke: #e8aa38;
  stroke-width: 4;
  stroke-dasharray: 6 20;
  animation: flow 1.8s linear infinite;
}
@keyframes flow {
  to {
    stroke-dashoffset: -104;
  }
}
.lamp-on {
  filter: drop-shadow(0 0 18px #f8c840);
}
.plant-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.plant-card {
  background: linear-gradient(#f1f7fc, #e8f0e2);
  border: 1px solid #dbe7dc;
  border-radius: 18px;
  padding: 15px;
  text-align: center;
}
.plant-card svg {
  width: 100%;
  max-height: 340px;
}
.plant-card h3 {
  margin: 3px;
}
.weather-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin: 20px 0;
}
.day {
  padding: 10px 5px;
  border-radius: 12px;
  background: #f3edf8;
  text-align: center;
  font-size: 0.8rem;
}
.day strong {
  font-size: 1.6rem;
  display: block;
  margin: 8px 0;
}
.weather-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 180px;
  gap: 20px;
  padding-top: 20px;
}
.weather-bar {
  background: #b6a0cf;
  min-width: 30px;
  max-width: 90px;
  width: 14%;
  border-radius: 10px 10px 0 0;
  position: relative;
  min-height: 2px;
}
.weather-bar span {
  position: absolute;
  top: -25px;
  left: 0;
  right: 0;
  text-align: center;
}
.weather-key {
  display: flex;
  justify-content: space-around;
  gap: 10px;
}
.experiment-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.experiment-fields .field:nth-last-child(1) {
  grid-column: 1/-1;
}
.progress {
  display: flex;
  gap: 6px;
  margin: 18px 0;
}
.progress span {
  height: 7px;
  flex: 1;
  border-radius: 8px;
  background: #e9e2ef;
}
.progress span.done {
  background: #a88aba;
}
.print-header {
  display: none;
}
.footnote {
  color: #796e84;
  font-size: 0.8rem;
  margin: 25px 0;
  line-height: 1.8;
}
body.projector header,
body.projector .hero,
body.projector nav,
body.projector .footnote {
  display: none;
}
body.projector main {
  max-width: 1600px;
}
body.projector .panel {
  min-height: 75vh;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
}
@media (max-width: 900px) {
  nav {
    grid-template-columns: repeat(3, 1fr);
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
  }
  .controls > label,
  .controls > .field {
    min-width: 180px;
    flex: 1;
  }
  .controls .hint,
  .controls .note {
    width: 100%;
  }
  .controls .buttons {
    align-self: center;
  }
  .weather-grid {
    gap: 4px;
  }
  .hero {
    padding-inline-end: 180px;
  }
  .hero-drawing {
    scale: 0.75;
    transform-origin: top right;
  }
}
@media (max-width: 600px) {
  header {
    flex-wrap: wrap;
    gap: 10px;
  }
  .badge {
    display: none;
  }
  header label {
    font-size: 0.8rem;
  }
  main {
    padding: 20px 12px;
  }
  .hero {
    padding: 0 0 20px;
    min-height: 0;
  }
  .hero-drawing {
    display: none;
  }
  h1 {
    font-size: 2rem;
  }
  nav {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .tile {
    padding: 12px;
    gap: 9px;
    min-height: 85px;
  }
  .tile .icon {
    width: 33px;
    height: 35px;
    font-size: 1.2rem;
  }
  .tile strong {
    font-size: 0.8rem;
  }
  .panel {
    padding: 17px;
  }
  .toolbar {
    gap: 8px;
  }
  .project-actions button,
  .import {
    font-size: 0.75rem;
    padding: 9px;
  }
  .story-grid,
  .experiment-fields,
  .fraction-pair {
    grid-template-columns: 1fr;
  }
  .shop-grid {
    grid-template-columns: 1fr 1fr;
  }
  .plant-pair {
    gap: 8px;
  }
  .plant-card {
    padding: 8px;
  }
  .plant-card h3 {
    font-size: 0.9rem;
  }
  .tool-head h2 {
    font-size: 1.3rem;
  }
  .tool-head .big-icon {
    font-size: 1.6rem;
  }
  .sequence-list li {
    padding: 10px;
    gap: 8px;
    font-size: 0.85rem;
  }
  .sequence-list .move {
    flex-direction: column;
  }
  .weather-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .experiment-fields .field:nth-last-child(1) {
    grid-column: auto;
  }
}
@page {
  size: A4;
  margin: 12mm;
}
@media print {
  body {
    background: white;
    color: black;
  }
  header,
  .hero,
  nav,
  .toolbar,
  #status,
  .controls,
  .subtabs,
  .footnote,
  button,
  .import,
  .hint.no-print {
    display: none !important;
  }
  main {
    padding: 0;
    max-width: none;
  }
  .panel {
    border: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }
  .workspace {
    display: block;
  }
  .visual,
  .fraction-card,
  .plant-card,
  .story-output {
    break-inside: avoid;
    background: white;
    box-shadow: none;
  }
  .print-header {
    display: block;
    border: 1px solid #777;
    padding: 12px;
    font-size: 11pt;
    line-height: 1.8;
    margin-bottom: 12px;
  }
  .tool-head {
    margin-bottom: 10px;
  }
  .tool-head p {
    color: black;
  }
  .story-grid,
  .experiment-fields {
    display: block;
  }
  .field {
    break-inside: avoid;
  }
  input[type="text"],
  textarea {
    border: 1px solid #aaa;
    color: black;
  }
  textarea {
    min-height: 80px;
  }
  .result {
    border: 1px solid #888;
    background: white;
  }
  .shop-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid-board button {
    display: block !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .weather-bar {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .sequence-list .move {
    display: none;
  }
  .plant-pair,
  .fraction-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .visual svg {
    max-height: 140mm;
  }
  .note {
    background: white;
    border: 1px solid #aaa;
  }
  .sequence-list li {
    break-inside: avoid;
  }
  .orb,
  .hero-drawing {
    display: none;
  }
}
.print-text {
  display: none;
}
@media print {
  @page {
    size: A4;
    margin: 27mm 12mm 15mm;
  }
  .print-header {
    position: fixed;
    top: -20mm;
    left: 0;
    right: 0;
    height: 15mm;
    padding: 5px 8px;
    margin: 0;
    font-size: 10pt;
  }
  .print-text {
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.7;
    min-height: 45px;
  }
  textarea,
  input[type="text"] {
    display: none !important;
  }
  .weather-key {
    flex-wrap: wrap;
  }
  .story-output {
    break-inside: auto;
  }
}
.weather-key {
  flex-wrap: wrap;
  text-align: center;
  font-size: 0.85rem;
}
.day {
  min-width: 0;
}
.day select {
  width: 100%;
  min-width: 0;
  font-size: 0.75rem;
  padding: 8px 3px;
}
.day .field {
  margin-bottom: 0;
}
.print-layout {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.print-layout > thead > tr > td,
.print-layout > tbody > tr > td {
  padding: 0;
  vertical-align: top;
}
@media print {
  @page {
    size: A4;
    margin: 12mm;
  }
  .print-layout > thead {
    display: table-header-group;
  }
  .print-header {
    position: static;
    inset: auto;
    display: block;
    height: auto;
    padding: 10px;
    margin: 0 0 15px;
    font-size: 10pt;
    background: white;
  }
  .print-layout > tbody > tr > td > article {
    break-inside: auto;
  }
  .day select {
    display: none;
  }
  .day .print-text {
    min-height: 20px;
    font-size: 9pt;
    margin: 0;
    white-space: normal;
  }
  input[type="range"],
  select {
    display: none !important;
  }
  body,
  html {
    background: white;
  }
}
@media print {
  :root {
    background: #fff !important;
    color: #000;
  }
  .day,
  .fraction-card,
  .plant-card,
  .controls,
  .story-output {
    background: white !important;
  }
  .day {
    border: 1px solid #bbb;
  }
  .progress span {
    background: #ccc !important;
  }
  .progress span.done {
    background: #666 !important;
  }
}
