:root { color-scheme: light; --ink: #223530; --muted: #66756e; --green: #176d57; --line: #dce5de; --paper: #fffcf5; }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #fff; font: 18px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
main { width: min(1280px,100%); margin: auto; padding: 20px 36px 16px; }
header { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.eyebrow { font-size: 12px; letter-spacing: .14em; color: var(--green); font-weight: 700; margin: 0 0 4px; }
h1 { font-size: 33px; letter-spacing: -.025em; line-height: 1.2; margin: 0; font-weight: 650; }
header label { display: flex; align-items: center; gap: 10px; color: var(--muted); white-space: nowrap; }
select, button { min-height: 42px; font: inherit; color: inherit; background: #fff; border: 1px solid #b9c9c0; border-radius: 6px; }
select { padding: 5px 12px; }
button { padding: 8px 23px; cursor: pointer; }
button:hover:not(:disabled) { background: #edf5f0; }
button.primary { background: var(--green); border-color: var(--green); color: #fff; }
button.primary:hover:not(:disabled) { background: #12513f; }
button:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 3px solid #327bc3; outline-offset: 4px; }
.setup { margin: 12px 0; font-size: 18px; color: var(--muted); }
.setup strong { color: var(--ink); font-weight: 500; }
.scene { padding: 13px 22px 10px; border: 1px solid #e4e5d7; background: var(--paper); border-radius: 13px; }
.scene-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 25px; }
.canteen, .queue-end { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: #857b5b; white-space: nowrap; }
#direction { text-align: center; color: var(--green); font-size: 17px; font-weight: 600; }
.queue { display: flex; justify-content: center; align-items: start; margin-top: 7px; }
.count-key { margin: 8px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.person { flex: 1 1 0; max-width: 250px; min-width: 0; text-align: center; padding: 0 12px; position: relative; }
.bubble { height: 63px; display: flex; align-items: center; justify-content: center; padding: 8px 12px; font-size: 16px; line-height: 1.25; border: 2px solid transparent; border-radius: 12px; position: relative; }
.bubble.speaking { background: #fff; border-color: var(--green); color: var(--green); }
.bubble.speaking::after { content: ""; position: absolute; width: 10px; height: 10px; bottom: -7px; left: calc(50% - 6px); background: #fff; border-right: 2px solid var(--green); border-bottom: 2px solid var(--green); transform: rotate(45deg); }
.person.base .bubble.speaking { border-color: #b67d20; color: #885611; background: #fff5d8; }
.person.base .bubble.speaking::after { background: #fff5d8; border-color: #b67d20; }
.student-art { width: 88px; height: 110px; display: block; margin: 8px auto 0; }
.person.idle .student-art { opacity: .65; }
.person.waiting .student-art { opacity: .8; }
.ground { width: 100px; height: 6px; border-radius: 50%; margin: -3px auto 4px; background: #dddccc; }
.person.active .ground { background: #86baa5; }
.person.base .ground { background: #e7c279; }
.person-name { display: block; font-size: 17px; line-height: 1.25; font-weight: 650; }
.person-status { display: block; font-size: 13px; color: var(--muted); height: 20px; margin: 2px 0; }
.personal-count { display: inline-flex; align-items: center; justify-content: center; min-width: 74px; min-height: 30px; padding: 2px 12px; font-size: 21px; line-height: 1.2; font-weight: 650; color: var(--green); background: #e8eee7; border-radius: 6px; }
.person.base .personal-count { background: #f4dfaa; color: #885611; }
.person.returning .personal-count, .person.done .personal-count { background: #d5ebdc; }
.connector { position: absolute; z-index: 2; top: 114px; left: calc(50% + 49px); width: calc(100% - 98px); height: 25px; color: var(--green); }
.connector::before { content: ""; position: absolute; top: 11px; left: 0; right: 0; height: 3px; background: currentColor; }
.connector::after { content: ""; position: absolute; top: 6px; right: 0; width: 10px; height: 10px; border-top: 3px solid; border-right: 3px solid; transform: rotate(45deg); }
.connector.answer::after { right: auto; left: 0; transform: rotate(-135deg); }
.connector span { position: relative; display: inline-block; background: var(--paper); padding: 0 5px; top: -14px; font-size: 14px; font-weight: 600; }
.explanation { display: flex; align-items: center; justify-content: space-between; gap: 32px; min-height: 84px; padding: 12px 0; }
.phase { margin: 0 0 3px; font-size: 13px; font-weight: 650; color: var(--green); }
.caption { margin: 0; font-size: 21px; line-height: 1.35; max-width: 870px; }
.total { flex: 0 0 145px; text-align: right; }
.total span { display: block; font-size: 14px; color: var(--muted); }
.total strong { display: block; font-size: 37px; color: var(--green); line-height: 1.1; }
.rules { display: grid; grid-template-columns: repeat(3,1fr); gap: 15px; border-top: 1px solid var(--line); padding: 10px 0; }
.rules > div { display: flex; align-items: flex-start; gap: 9px; padding: 6px 8px; border-radius: 6px; }
.rules > div > span { display: inline-flex; justify-content: center; align-items: center; flex: 0 0 24px; height: 24px; border: 1px solid #c6d4cd; border-radius: 50%; font-size: 13px; color: var(--muted); }
.rules p { margin: 0; font-size: 14px; color: var(--muted); }
.rules strong { display: block; font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.rules .selected { background: #eaf5ef; }
.rules .selected > span { background: var(--green); border-color: var(--green); color: #fff; }
#rule-stop.selected { background: #fff2d0; }
.controls { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 2px; }
.transport { display: flex; gap: 10px; }
#step-number { color: var(--muted); font-size: 15px; }
footer { display: flex; justify-content: space-between; gap: 15px; margin-top: 14px; font-size: 14px; color: var(--muted); }
footer a { color: var(--green); text-underline-offset: 3px; }
@media (max-width:1000px) {
  main { padding: 18px 24px; }
  h1 { font-size: 29px; }
  .scene { padding-inline: 12px; }
  .person { padding-inline: 7px; }
  .bubble { font-size: 14px; padding-inline: 6px; }
  .connector { left: calc(50% + 43px); width: calc(100% - 86px); }
  .rules { gap: 4px; }
  .caption { font-size: 20px; }
}
@media (max-width:700px) {
  main { padding: 18px 16px; }
  header { align-items: start; flex-wrap: wrap; gap: 14px; }
  h1 { font-size: 28px; }
  .setup { font-size: 16px; }
  .scene { padding: 10px 5px; }
  .scene-heading { flex-wrap: wrap; padding: 0 8px; gap: 5px; }
  #direction { flex: 1 0 100%; order: 3; font-size: 15px; }
  .canteen, .queue-end { font-size: 9px; }
  .queue-end { margin-left: auto; }
  .person { padding: 0 2px; }
  .bubble { height: 112px; font-size: 12px; padding: 4px 2px; border-radius: 7px; overflow-wrap: anywhere; }
  .student-art { width: 54px; height: 78px; margin-top: 7px; }
  .ground { width: 48px; height: 4px; }
  .person-name { font-size: 13px; }
  .person-status { font-size: 10px; height: 28px; line-height: 1.2; }
  .personal-count { min-width: 44px; padding-inline: 5px; font-size: 16px; }
  .connector { top: 148px; left: calc(50% + 21px); width: calc(100% - 42px); }
  .connector span { font-size: 10px; padding: 0 2px; top: -12px; }
  .connector::before { height: 2px; }
  .connector::after { width: 7px; height: 7px; top: 8px; border-width: 2px; }
  .explanation { gap: 12px; min-height: 120px; align-items: start; }
  .caption { font-size: 18px; }
  .total { flex-basis: 65px; }
  .total span { font-size: 12px; }
  .total strong { font-size: 32px; }
  .rules { grid-template-columns: 1fr; gap: 2px; }
  .rules strong { font-size: 15px; }
  .rules p { font-size: 13px; }
  .controls { gap: 10px; flex-wrap: wrap; }
  button { padding-inline: 17px; }
  footer { flex-direction: column; gap: 8px; }
}
