:root {
  color-scheme: light;
  --bg: #f6f8f5;
  --panel: #ffffff;
  --ink: #1b241f;
  --muted: #5f6d66;
  --line: #d9e1dc;
  --green: #1d8f61;
  --green-dark: #0f6b48;
  --blue: #276fbf;
  --amber: #b87014;
  --danger: #ba3b38;
  --shadow: 0 18px 42px rgba(24, 48, 35, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.55;
}

body,
input,
textarea,
select,
button {
  overflow-wrap: break-word;
  word-break: keep-all;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(39, 111, 191, 0.55);
  outline-offset: 3px;
}

button,
input,
select {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 48px);
  background: rgba(246, 248, 245, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.hamburger-menu {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 9px;
}

.hamburger-menu span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: var(--ink);
}

.hamburger-menu span + span {
  margin-top: 6px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

nav a {
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
}

nav a:hover {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.tool-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 22px;
  padding: 42px 0 22px;
}

.tool-main,
.tool-visual,
.diagnosis-card,
.game-board,
.guide-article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.tool-main {
  padding: clamp(22px, 4vw, 34px);
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--green-dark);
  font-size: 0.84rem;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.18;
}

h1 {
  max-width: 720px;
  font-size: clamp(2rem, 5vw, 3.4rem);
}

h2 {
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

.lead {
  max-width: 680px;
  margin: 14px 0 22px;
  color: var(--muted);
  font-size: 1.05rem;
}

.upload-panel {
  border: 2px dashed #aac4b5;
  border-radius: 8px;
  background: #f9fcfa;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-panel.is-dragging {
  border-color: var(--green);
  background: #eef9f3;
}

.upload-panel input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.upload-panel label {
  display: grid;
  min-height: 150px;
  place-items: center;
  gap: 4px;
  padding: 22px;
  color: var(--muted);
  cursor: pointer;
}

.upload-panel strong {
  color: var(--ink);
  font-size: 1.15rem;
}

.upload-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
}

.controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.controls label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.controls input,
.controls select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.quality-control {
  grid-column: span 1;
}

.quality-control input {
  padding: 0;
  accent-color: var(--green);
}

.actions,
.game-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 7px;
  background: var(--green);
  color: #fff;
  padding: 0 18px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--green-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

button.secondary:hover {
  border-color: #b7c4bd;
  background: #f5f8f6;
}

.status {
  min-height: 28px;
  margin: 14px 0 0;
  color: var(--muted);
}

.tool-visual {
  align-self: stretch;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
}

.tool-visual img {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
}

.visual-note {
  display: grid;
  gap: 3px;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
}

.visual-note span {
  color: var(--muted);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  min-height: 160px;
  padding: 10px 0 26px;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 160px;
  border: 1px dashed #b7c4bd;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  text-align: center;
}

.empty-state h2 {
  font-size: 1.25rem;
}

.empty-state p {
  margin: 6px 0 0;
  color: var(--muted);
}

.result-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(24, 48, 35, 0.07);
}

.preview-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preview-pair figure {
  min-width: 0;
  margin: 0;
}

.preview-pair img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  background: #eef2ef;
  object-fit: cover;
}

.preview-pair figcaption {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
}

.result-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat {
  border-radius: 7px;
  background: #f4f7f5;
  padding: 9px;
}

.stat span,
.meter span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.stat strong {
  display: block;
  margin-top: 2px;
}

.download-link {
  display: inline-grid;
  min-height: 42px;
  place-items: center;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}

.diagnosis {
  padding: 8px 0 32px;
}

.diagnosis h2 {
  margin-bottom: 12px;
  font-size: 1.35rem;
}

.diagnosis-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
}

.score {
  display: grid;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #e9f7ef;
  color: var(--green-dark);
  font-size: 1.55rem;
  font-weight: 900;
}

.diagnosis-card p {
  margin: 0;
  color: var(--muted);
}

.utilities {
  padding: 12px 0 34px;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 18px;
}

.section-heading p,
.utility-card p,
.tool-note {
  color: var(--muted);
}

.utility-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.utility-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: clamp(18px, 3vw, 24px);
  box-shadow: 0 12px 28px rgba(24, 48, 35, 0.08);
}

.utility-card h3 {
  margin: 0;
  font-size: 1.28rem;
}

.utility-card p {
  margin: 0;
}

.utility-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
}

.utility-card input,
.utility-card select,
.utility-card textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

.utility-card textarea {
  resize: vertical;
}

.inline-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.check-list {
  display: grid;
  gap: 8px;
}

.check-list label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--ink);
}

.check-list input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
  accent-color: var(--green);
}

.result-box {
  min-height: 96px;
  border-radius: 8px;
  background: #f4f7f5;
  padding: 14px;
  color: var(--ink);
}

.result-box strong {
  color: var(--green-dark);
}

.result-box ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

#qrCanvas {
  width: min(100%, 300px);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.secondary-link {
  display: inline-grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  text-decoration: none;
  font-weight: 800;
}

.secondary-link.is-disabled {
  pointer-events: none;
  opacity: 0.45;
}

.game-section {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(320px, 1.25fr);
  gap: 20px;
  align-items: start;
  padding: 30px 0;
}

.game-section p {
  color: var(--muted);
}

.game-board {
  padding: 18px;
}

.meter {
  display: inline-grid;
  min-width: 130px;
  margin: 0 8px 14px 0;
  border-radius: 8px;
  background: #f4f7f5;
  padding: 12px;
}

.meter strong {
  font-size: 1.35rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.choice-grid button {
  min-height: 72px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.choice-grid button:hover {
  border-color: var(--green);
}

.choice-grid button.is-picked {
  border-color: var(--green);
  background: #ecf8f1;
  color: var(--green-dark);
}

.game-actions {
  margin-top: 14px;
}

.game-actions p {
  margin: 0;
}

.arcade-section {
  padding: 30px 0;
}

.arcade-layout {
  display: grid;
  grid-template-columns: minmax(250px, 0.75fr) minmax(0, 1.25fr);
  gap: 16px;
}

.arcade-menu {
  display: grid;
  gap: 10px;
}

.arcade-tile {
  display: grid;
  gap: 5px;
  min-height: 92px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.arcade-tile span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.arcade-tile.is-active {
  border-color: var(--green);
  background: #ecf8f1;
  color: var(--green-dark);
}

.arcade-stage {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: clamp(16px, 3vw, 22px);
  box-shadow: 0 12px 28px rgba(24, 48, 35, 0.08);
}

.arcade-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.arcade-head h3 {
  margin: 0;
  font-size: 1.45rem;
}

.arcade-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.arcade-score {
  display: grid;
  min-width: 84px;
  border-radius: 8px;
  background: #f4f7f5;
  padding: 10px;
  text-align: center;
}

.arcade-score span {
  color: var(--muted);
  font-size: 0.82rem;
}

.arcade-score strong {
  font-size: 1.45rem;
}

.arcade-play {
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  padding: 14px;
}

.arcade-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.arcade-actions p {
  margin: 0;
  color: var(--muted);
}

.reaction-pad {
  display: grid;
  min-height: 290px;
  place-items: center;
  border-radius: 8px;
  background: #dfe7e2;
  color: var(--ink);
  font-size: clamp(1.3rem, 4vw, 2rem);
  font-weight: 900;
  text-align: center;
  transition: background 0.16s ease, color 0.16s ease;
}

.reaction-pad.is-ready {
  background: #a9e7c2;
  color: #0f5132;
}

.reaction-pad.is-waiting {
  background: #f2e5c4;
}

.balloon-game {
  display: grid;
  gap: 12px;
}

.balloon-canvas {
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 2px solid #1b241f;
  border-radius: 8px;
  background: #dff2ff;
  image-rendering: pixelated;
}

.balloon-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.balloon-panel span {
  border-radius: 7px;
  background: #f4f7f5;
  padding: 8px 10px;
  text-align: center;
  font-size: 0.92rem;
}

.balloon-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.balloon-controls button {
  min-height: 48px;
  padding: 0 10px;
}

.color-game {
  display: grid;
  min-height: 290px;
  place-items: center;
  gap: 16px;
  text-align: center;
}

.color-word {
  font-size: clamp(2.4rem, 7vw, 4.5rem);
  font-weight: 900;
}

.color-buttons {
  display: flex;
  gap: 10px;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.memory-card {
  min-height: 74px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 1.5rem;
}

.memory-card.is-open,
.memory-card.is-done {
  border-color: var(--green);
  background: #ecf8f1;
  color: var(--green-dark);
}

.dodge-wrap {
  display: grid;
  gap: 14px;
  place-items: center;
}

.dodge-grid {
  display: grid;
  width: min(100%, 320px);
  aspect-ratio: 1;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.dodge-cell {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.dodge-cell.is-player {
  background: var(--blue);
}

.dodge-cell.is-danger {
  background: var(--danger);
}

.dodge-controls {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  gap: 8px;
  place-items: center;
}

.dodge-controls button {
  width: 52px;
  min-height: 46px;
  padding: 0;
}

.dodge-controls .wide {
  grid-column: 1 / -1;
}

.guide-article {
  margin: 10px 0 34px;
  padding: clamp(20px, 4vw, 34px);
}

.guide-article p {
  max-width: 760px;
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  background: #eef5f1;
}

tr:last-child td {
  border-bottom: 0;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 24px clamp(18px, 4vw, 48px) 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

footer a {
  min-height: 28px;
}

.bottom-cta {
  display: none;
}

@media (max-width: 900px) {
  .tool-shell,
  .game-section,
  .arcade-layout {
    grid-template-columns: 1fr;
  }

  .controls,
  .results-grid,
  .utility-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body {
    padding-bottom: 78px;
  }

  .site-header,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .hamburger-menu {
    display: block;
  }

  nav {
    grid-column: 1 / -1;
    display: none;
    width: 100%;
  }

  .site-header.is-open nav {
    display: flex;
  }

  nav a {
    flex: 1 1 auto;
    text-align: center;
  }

  .controls,
  .results-grid,
  .choice-grid,
  .utility-grid,
  .inline-controls {
    grid-template-columns: 1fr;
  }

  .diagnosis-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .arcade-head {
    flex-direction: column;
  }

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

  .balloon-panel,
  .balloon-controls {
    grid-template-columns: 1fr;
  }

  .bottom-cta {
    position: fixed;
    right: 12px;
    bottom: 10px;
    left: 12px;
    z-index: 20;
    display: grid;
    min-height: 52px;
    place-items: center;
    border-radius: 8px;
    background: var(--green);
    color: #fff;
    text-decoration: none;
    font-weight: 900;
    box-shadow: 0 14px 32px rgba(16, 107, 72, 0.28);
  }
}
