:root {
  color-scheme: light;
  --ink: #20221f;
  --paper: #f4eddf;
  --tomato: #df4c35;
  --mustard: #e1ae33;
  --green: #3f7758;
  --blue: #3b6980;
  --line: #292b27;
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #d9d0c2; min-width: 300px; }
button, input { font: inherit; }
button { cursor: pointer; }
.topbar { min-height: 220px; padding: 34px max(5vw, 24px); display: flex; align-items: center; gap: 24px; color: #fff9ed; background: var(--tomato); border-bottom: 5px solid var(--line); position: relative; }
.topbar h1 { font-size: clamp(2.1rem, 5vw, 4.6rem); line-height: .95; letter-spacing: -.05em; margin: 6px 0 0; max-width: 900px; }
.brand-mark { flex: 0 0 auto; display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; font: 700 3.6rem/1 Arial, sans-serif; color: var(--tomato); background: #fff9ed; border: 4px solid var(--line); transform: rotate(-7deg); box-shadow: 5px 5px 0 var(--line); }
.eyebrow { margin: 0; font: 800 .76rem/1.2 Arial, sans-serif; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow.dark { color: #5c5b54; }
.icon-button { position: absolute; right: max(5vw, 24px); top: 28px; padding: 9px 15px; border: 2px solid #fff9ed; color: #fff9ed; background: transparent; font: 700 .82rem Arial, sans-serif; }
main { width: min(1400px, 100%); margin: 0 auto; padding: 34px max(3vw, 18px) 70px; }
.intro { display: flex; justify-content: space-between; gap: 32px; align-items: end; padding: 22px 0 30px; }
.round-label { display: inline-block; margin: 0 0 8px; padding: 5px 9px; color: white; background: var(--ink); font: 700 .76rem Arial, sans-serif; }
.intro h2, .section-heading h2, .feedback-head h2 { margin: 0 0 5px; font-size: clamp(1.45rem, 2.8vw, 2.25rem); }
.intro p:last-child { margin: 0; color: #5d5b55; }
.score-strip { display: flex; border: 3px solid var(--line); background: var(--paper); box-shadow: 5px 5px 0 rgba(41,43,39,.28); }
.score-strip div { min-width: 88px; padding: 12px 17px; text-align: center; border-right: 2px solid var(--line); }
.score-strip div:last-child { border: 0; }
.score-strip span { display: block; font: 800 1.35rem Arial, sans-serif; }
.score-strip small { color: #666158; font: 700 .67rem Arial, sans-serif; }
.table-zone { padding: 24px; background: #f7c95b; border: 3px solid var(--line); box-shadow: 7px 7px 0 var(--line); }
.section-heading, .feedback-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.selection-hint { max-width: 400px; margin: 0; font-size: .9rem; text-align: right; }
.item-tray { min-height: 130px; margin-top: 20px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.item-card { position: relative; width: 158px; min-height: 106px; padding: 15px 14px 12px; text-align: left; color: var(--ink); background: #fffaf0; border: 2px solid var(--line); box-shadow: 3px 3px 0 rgba(41,43,39,.55); transition: transform .15s, box-shadow .15s; user-select: none; touch-action: manipulation; overflow-wrap: anywhere; }
.item-card:nth-child(even) { transform: rotate(1deg); }
.item-card:nth-child(3n) { transform: rotate(-1.2deg); }
.item-card:hover, .item-card:focus-visible { z-index: 2; transform: translateY(-3px) rotate(0); box-shadow: 5px 7px 0 rgba(41,43,39,.42); outline: 3px solid #fff; }
.item-card.selected { background: #fff; outline: 4px solid var(--blue); transform: translateY(-5px); }
.item-card.placed { width: 100%; min-height: 0; padding: 11px 12px; box-shadow: none; transform: none; }
.item-emoji { display: block; margin-bottom: 7px; font: 1.6rem/1 Arial, sans-serif; }
.item-name { display: block; font: 800 .95rem/1.15 Arial, sans-serif; }
.item-detail { display: block; margin-top: 5px; color: #68655e; font: .74rem/1.25 Arial, sans-serif; }
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 30px; }
.lane { min-height: 330px; background: #eee7db; border: 3px solid var(--line); transition: transform .15s, background .15s; }
.lane:focus-visible { outline: 4px solid #fff; }
.lane.drag-over, .lane.target-ready:hover { transform: translateY(-4px); background: #fff8e9; }
.lane header { min-height: 105px; display: flex; gap: 12px; align-items: center; padding: 16px; color: white; border-bottom: 3px solid var(--line); }
.lane-safe header { background: var(--green); }
.lane-high header { background: var(--tomato); }
.lane-check header { background: var(--blue); }
.lane-icon { flex: 0 0 42px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); background: #fff9ed; border: 2px solid var(--line); font: 900 1.35rem Arial, sans-serif; }
.lane h3 { margin: 0 0 4px; font-size: 1.35rem; }
.lane header p { margin: 0; opacity: .9; font-size: .78rem; }
.lane-drop { min-height: 218px; padding: 12px; display: flex; flex-direction: column; gap: 9px; }
.empty-note { margin: auto; color: #8a857b; font-style: italic; }
.feedback-panel { margin-top: 32px; padding: 24px; background: var(--paper); border: 3px solid var(--line); }
.text-button { padding: 7px 2px; border: 0; border-bottom: 2px solid currentColor; color: var(--ink); background: transparent; font: 700 .8rem Arial, sans-serif; }
.text-button.danger { color: #a03224; }
.feedback-list { margin-top: 18px; display: grid; gap: 8px; }
.feedback-empty { color: #78736a; font-style: italic; }
.feedback-row { display: grid; grid-template-columns: 28px minmax(90px, 160px) 1fr; gap: 10px; align-items: start; padding: 11px 0; border-top: 1px dashed #aaa193; }
.feedback-row:first-child { border-top: 0; }
.feedback-status { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--green); font: 800 .78rem Arial, sans-serif; }
.feedback-row.wrong .feedback-status { background: var(--tomato); }
.feedback-row strong { font-family: Arial, sans-serif; }
.feedback-row p { margin: 0; line-height: 1.42; }
.result-panel { margin-top: 28px; padding: 30px; color: white; background: var(--ink); border: 4px solid var(--mustard); box-shadow: 7px 7px 0 var(--mustard); }
.result-panel h2 { margin: 8px 0; font-size: 2.1rem; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.primary-button, .secondary-button { padding: 12px 18px; border: 2px solid white; font: 800 .86rem Arial, sans-serif; }
.primary-button { color: var(--ink); background: var(--mustard); }
.secondary-button { color: white; background: transparent; }
.safety-note { margin-top: 30px; padding: 16px 18px; display: flex; gap: 10px; line-height: 1.45; color: #fff; background: #5c302b; border-left: 8px solid var(--tomato); }
dialog { width: min(560px, calc(100% - 28px)); padding: 28px; color: var(--ink); background: #fffaf0; border: 3px solid var(--line); box-shadow: 9px 9px 0 rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(25,26,24,.7); }
dialog h2 { margin: 8px 0 18px; font-size: 1.8rem; }
dialog li { margin: 10px 0; line-height: 1.45; }
.dialog-close { position: absolute; top: 10px; right: 13px; border: 0; background: transparent; font: 2rem Arial, sans-serif; }
.dialog-warning { padding: 11px; background: #f2d0c9; border-left: 5px solid var(--tomato); }
.review-list { display: grid; gap: 10px; margin: 16px 0 22px; max-height: 48vh; overflow: auto; }
.review-item { padding: 12px; border: 2px solid var(--line); background: #f4eddf; }
.review-item strong { display: block; margin-bottom: 5px; font-family: Arial, sans-serif; }
.review-item p { margin: 0; line-height: 1.4; }

@media (max-width: 760px) {
  .topbar { min-height: 185px; align-items: flex-end; padding-bottom: 27px; }
  .brand-mark { width: 54px; height: 54px; font-size: 2.4rem; }
  .topbar h1 { font-size: clamp(1.75rem, 9vw, 3rem); }
  .intro { display: block; }
  .score-strip { margin-top: 20px; width: 100%; }
  .score-strip div { flex: 1; min-width: 0; padding-inline: 8px; }
  .section-heading { display: block; }
  .selection-hint { margin-top: 8px; text-align: left; }
  .item-tray { display: grid; grid-template-columns: repeat(2, 1fr); }
  .item-card { width: 100%; }
  .board { grid-template-columns: 1fr; }
  .lane { min-height: 190px; }
  .lane header { min-height: 82px; }
  .lane-drop { min-height: 100px; }
  .feedback-row { grid-template-columns: 28px 1fr; }
  .feedback-row p { grid-column: 2; }
  .safety-note { display: block; }
}

@media (max-width: 400px) {
  .brand-mark { display: none; }
  .topbar { padding-inline: 18px; }
  .icon-button { right: 18px; }
  main { padding-inline: 12px; }
  .table-zone, .feedback-panel { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
