:root {
  --paper: #fff8e7;
  --edge: #343b32;
  --forest: #315641;
  --mint: #b5d6a5;
  --honey: #ffd373;
  --display: "Do Hyeon", var(--font);
  --dock-bottom: max(24px, env(safe-area-inset-bottom));
}
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.pixel { display: inline-block; width: 20px; height: 20px; fill: currentColor; shape-rendering: crispEdges; flex: none; }
button, summary { touch-action: manipulation; }
button:focus-visible, summary:focus-visible { outline: 3px solid #206347; outline-offset: 3px; }

#onboarding { justify-content: flex-end; padding-bottom: max(22px, env(safe-area-inset-bottom)); }
.village-sign {
  position: absolute; top: max(6dvh, env(safe-area-inset-top)); text-align: center;
  color: var(--forest); filter: drop-shadow(0 2px 0 #fff9);
}
.village-sign span {
  display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 850;
  letter-spacing: .03em; padding: 4px 13px; border: 1px solid #58624966; border-radius: 20px; background: #fff8e6ed;
}
.village-sign .pixel { width: 14px; height: 14px; }
.village-sign h1 {
  margin: 5px 0; font: 400 clamp(48px, 7vw, 74px)/1.1 var(--display);
  letter-spacing: -.055em; color: #2d4839; -webkit-text-stroke: 5px var(--paper);
  paint-order: stroke fill; text-shadow: 0 4px 0 #b5b798;
}
.ob-card, #pocket, .class-dialog, .activity-panel, .board-panel, .class-presentation {
  color: var(--edge); background: var(--paper); border: 2px solid var(--edge);
  box-shadow: 0 5px 0 #333d3280, inset 0 2px 0 #fff;
}
#cardName { text-align: left; padding: 17px 20px 10px; width: min(420px, 100%); }
.entry-heading, .pocket-heading { display: flex; align-items: center; gap: 8px; }
.entry-heading { justify-content: space-between; margin-bottom: 12px; }
.ob-title, .pocket-heading h2, .activity-heading h2, .board-heading h2, .class-panel-heading h2 {
  font: 400 29px/1.08 var(--display); color: var(--forest); letter-spacing: -.035em; margin: 0;
}
#cardName label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 800; }
#shuffleAnimal {
  min-height: 40px; padding: 5px 11px; border-radius: 12px; border: 1.5px solid #a59e8b;
  background: #f4ecd8; color: var(--edge); cursor: pointer; font: 750 14px var(--font);
}
#entryAnimal { margin-right: 6px; }
.ob-input { background: #fffdf6; border-color: #818772; border-radius: 10px; font-weight: 600; }
.ob-note { margin: 0 0 13px; padding: 0; background: transparent; color: #5b6855; }
.ob-note.is-error { color: #973e39; }
.btn-primary { background: var(--forest); color: #fffaf0; font: 400 21px var(--display); }
.btn-primary:disabled { background: #d4ddc5; color: #57634e; opacity: 1; border-color: #a3ae96; }
.room-entry { display: block; margin-top: 13px; padding-top: 1px; border-top: 1px dashed #babba6; }
.room-entry summary { text-align: center; padding: 12px 0 6px; font-size: 13px; font-weight: 750; cursor: pointer; }
.room-entry[open] summary { margin-bottom: 8px; }
.room-entry #createClassroomBtn { width: 100%; margin-top: 5px; }
.room-entry .class-error { margin-block: 4px; }

.brand { gap: 7px; background: #fff9eae8; border: 1px solid #54624d69; padding: 8px 12px; color: #364f3b; box-shadow: 0 2px 1px #34433520; font-size: 13px; }
.brand .pixel { width: 15px; height: 15px; }
.brand-dot { display: none; }
.brand:has(.reconnecting) .pixel { color: #9a652d; }
body[data-class-gathered] .brand::after { content: attr(data-gather-place) ' 집합'; font-size: 12px; color: #496b42; }
#classStatus { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(100%); }

#bagButton, #btnJump, #btnEnter {
  pointer-events: auto; display: grid; place-content: center; justify-items: center; gap: 3px;
  border: 2px solid var(--edge); color: var(--edge); cursor: pointer;
  box-shadow: inset 0 3px 0 #fff8, inset 0 -4px 0 #5f67312b, 0 4px 0 #343e3299;
}
#bagButton {
  position: fixed; z-index: 25; bottom: var(--dock-bottom); left: 50%; transform: translateX(-50%);
  width: 80px; height: 80px; border-radius: 50%; background: var(--mint); color: #294d39;
  font: 400 16px/1 var(--display);
}
#bagButton::before { content: ''; position: absolute; inset: 5px; border: 1px dashed #48634377; border-radius: inherit; }
#bagButton .pixel { width: 31px; height: 31px; }
#bagButton[aria-expanded="true"] { background: var(--forest); color: var(--paper); }
#bagButton[aria-expanded="true"]::before { border-color: #e3efc272; }
body[data-class-teacher] #bagButton { background: #f2c493; color: #654029; }
body[data-class-teacher] #bagButton[aria-expanded="true"] { background: #805334; color: var(--paper); }
.action-cluster { display: block; right: max(24px, env(safe-area-inset-right)); bottom: var(--dock-bottom); }
#btnJump { width: 65px; height: 65px; border-radius: 50%; background: #fff6df; font: 400 16px/1 var(--display); }
#btnEnter { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: var(--dock-bottom); z-index: 24;
  width: max-content; max-width: 30vw; min-height: 76px; height: auto; padding: 7px 10px; gap: 2px;
  border-radius: 20px; background: var(--honey); font: 400 18px/1 var(--display); }
#btnEnter small { font: 700 10px/1.2 var(--font); }
.joy-base { width: 88px; height: 88px; bottom: var(--dock-bottom); border-color: #36473978;
  background: #fff8e995; box-shadow: inset 0 0 0 6px #fff7, 0 3px 0 #3a432e42; }
.joy-base::before { content: ''; position: absolute; inset: 10px; border: 1px dashed #62735d88; border-radius: 50%; }
.joy-thumb { width: 39px; height: 39px; background: #f8f1dc; border-color: #57664d; }
#pocket {
  position: fixed; z-index: 26; left: 50%; bottom: calc(var(--dock-bottom) + 95px); transform: translateX(-50%);
  width: min(390px, calc(100vw - 24px)); padding: 17px; border-radius: 22px;
  max-height: calc(100dvh - var(--dock-bottom) - 160px); overflow: auto; pointer-events: auto;
  animation: pocket-in .16s ease-out;
}
@keyframes pocket-in { from { opacity: 0; translate: 0 7px; } }
.pocket-heading { margin-bottom: 12px; color: var(--forest); }
.pocket-heading h2 { flex: 1; }
#pocket button { border: 1px solid #aaa993; border-radius: 10px; background: #fffcf1; color: var(--edge);
  font: 750 13px/1.2 var(--font); min-height: 44px; cursor: pointer; padding: 5px 9px; }
#pocket .close-pocket { width: 42px; background: transparent; border-color: transparent; font: 24px var(--font); }
.pocket-tabs { display: flex; gap: 3px; padding: 3px; border-radius: 13px; background: #eae5d5; }
.pocket-tabs button { flex: 1; }
#pocket .pocket-tabs button { border: 0; background: transparent; }
#pocket .pocket-tabs button[aria-pressed="true"] { background: var(--forest); color: var(--paper); }
.tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin-top: 10px; }
.tool-grid button, .pocket-extras button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
#pocket #classGatherBtn { background: var(--honey); border-color: #817044; }
#pocket :is(#classGatherBtn, #classFreeBtn):disabled { display: none; }
#pocket #classShortcuts { position: static; transform: none; display: grid; grid-template-columns: minmax(0,1.05fr) minmax(0,1fr) minmax(0,1.35fr) repeat(2,minmax(0,.9fr));
  gap: 4px; padding: 12px 0; margin: 0; max-width: none; overflow: visible; }
#pocket #classShortcuts button { position: relative; display: grid; justify-items: center; align-content: center; gap: 7px;
  white-space: normal; word-break: keep-all; font-size: 12px; padding: 5px 1px; min-height: 67px; background: #f3eddd; border-color: #d8cfb7; }
#pocket #classShortcuts .pixel { color: #557a58; }
#pocket #classShortcuts button[data-badge]::after { position: absolute; right: -2px; top: -4px; }
#pocket[data-managing] #classShortcuts { display: none; }
.pocket-extras { display: flex; flex-wrap: wrap; gap: 5px; border-top: 1px dashed #c1b8a0; padding-top: 10px; }
#pocket .pocket-extras button { flex: 1; color: #4d5a46; border: 0; background: #f1ebda; }
#pocket .pocket-extras .pixel { width: 16px; height: 16px; }
.pocket-setting { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 10px; color: var(--edge); font: 750 13px/1.2 var(--font); }
.pocket-setting select { min-height: 44px; min-width: 100px; padding: 5px 9px; border: 1px solid #aaa993;
  border-radius: 10px; background: #fffcf1; color: inherit; font: inherit; }
.class-map-setting { grid-column: 1 / -1; margin-top: 3px; }
#managementTools:not(.hidden) { margin-bottom: 12px; }
body[data-class-gathered] .movement-tool { display: none; }
#pocket #emojiBar, #pocket #pcHint { position: static; transform: none; margin-top: 9px; }
#pocket #emojiBar { display: flex; justify-content: center; gap: 3px; flex-wrap: wrap; }
#pocket #emojiBar button { min-width: 36px; padding: 2px; font-size: 21px; }
#pocket #pcHint { flex-wrap: wrap; white-space: normal; gap: 5px 10px; }
body[data-class-overlay] :is(#bagButton, #btnEnter, #mobileControls, #pocket) { display: none; }
body[data-class-overlay] #hudLayer::before { content: ''; position: absolute; inset: 0; background: #27382e38; }
body[data-class-overlay] .top-left { display: none; }

body .activity-panel, body .board-panel, body[data-class-teacher] .class-presentation, body .class-presentation {
  top: auto; bottom: max(14px, env(safe-area-inset-bottom)); max-height: calc(100dvh - 32px);
  width: min(640px, calc(100vw - 24px)); border-radius: 23px; padding: 18px;
}
.activity-panel, .board-panel { height: fit-content; }
.chat-panel { height: min(570px, calc(100dvh - 32px)); }
body[data-chat-keyboard] .chat-panel { height: auto; max-height: none; }
.activity-heading, .board-top { border: 0; padding: 0; }
.activity-heading, .board-heading, .class-presentation .class-panel-heading { padding-bottom: 12px; border-bottom: 1px dashed #c8bfa8; }
.activity-heading h2, .board-heading h2, .class-panel-heading h2 { font-size: 26px; }
body .board-panel { min-height: min(420px, 64dvh); }
#boardPrompt { font: 400 21px/1.3 var(--display); margin: 15px 0; }
.board-card { border-color: #ccc3ab; background: #fffdf4; padding: 12px; }
.board-compose { background: #f0eedc; }
#quizLivePrompt { font: 400 clamp(27px,5vw,36px)/1.26 var(--display); margin-block: 20px; color: var(--edge); }
#quizChoices { gap: 8px; }
#quizChoices .quiz-option { min-height: 56px; border: 1.5px solid #565e5170; }
#classSlideBody p { background: #e7edda; color: #324b36; font: 400 clamp(21px,4vw,28px)/1.45 var(--display); }
body[data-class-gathered] #classPresentation:not(.is-collapsed)::before { content: attr(data-gather-place) ' 집합 · 발표 중'; display: block;
  width: fit-content; margin-bottom: 9px; color: #526b45; font-size: 12px; font-weight: 800; }
.board-card .card-menu { margin-left: auto; }
.card-menu summary { display: inline-grid; place-items: center; min-width: 44px; min-height: 40px; font-size: 22px; cursor: pointer; list-style: none; }
.card-menu summary::-webkit-details-marker { display: none; }
.chat-message .card-menu { text-align: right; }
body:has(dialog[open]) #mobileControls { visibility: hidden; }
@media (max-height: 540px) {
  #onboarding { align-items: flex-end; padding: 8px; }
  #cardName, .ob-card { max-height: calc(100dvh - 16px); overflow: auto; width: min(365px, 52vw); }
  .village-sign { left: 20px; top: 12px; }
  #pocket { bottom: 7px; left: auto; right: 8px; transform: none; max-height: calc(100dvh - 14px); }
}
@media (prefers-reduced-motion: reduce) { #pocket { animation: none; } }
#bagButton { padding: 0; white-space: nowrap; }
body[data-class-teacher] #bagLabel { font-size: 14px; }
#onboarding::before { content: ''; position: absolute; inset: 0 0 auto; height: 17dvh; pointer-events: none; background: linear-gradient(#f6f5e9ce, transparent); }
#boardComposer { margin-top: 12px; }
#boardComposer > summary { width: fit-content; min-height: 42px; padding: 10px 15px; list-style: none; border: 1.5px solid var(--edge);
  border-radius: 12px; background: var(--mint); font-weight: 800; cursor: pointer; }
#boardComposer > summary::-webkit-details-marker { display: none; }
#boardComposer[open] > summary { background: #eee9d6; }
.board-card { border-radius: 3px 12px 12px 12px; border-top: 4px solid #9dbfa4; }
.board-card:nth-child(3n + 2) { border-top-color: #dab276; }
.board-card:nth-child(3n) { border-top-color: #a5bbd2; }

.edit-entry { min-height: 44px; border: 0; background: transparent; color: var(--forest); font: 750 13px var(--font); text-decoration: underline; cursor: pointer; }
