:root {
  --ink: #1b1626;
  --paper: #fbf8f2;
  --paper-2: #efe8dc;
  --red: #c8323c;
  --red-d: #9e222b;
  --green: #2f6b4a;
  --muted: #6a6478;
  --glass: rgba(27, 22, 38, 0.72);
  --font: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #dfe9f3; color: var(--ink); font-family: var(--font); }
#game { display: block; position: fixed; inset: 0; touch-action: none; cursor: pointer; }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }

/* panels */
.panel-wrap { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(20, 24, 48, 0.45); backdrop-filter: blur(3px); z-index: 20; }
.panel { width: min(500px, 100%); background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 6px 0 var(--ink); padding: 22px 22px 20px; }
.panel.small { width: min(400px, 100%); }
.panel h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.5px; }
.panel h2 { margin: 0 0 6px; font-size: 19px; }
.sub { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.join-grid { display: grid; grid-template-columns: 140px 1fr; gap: 16px; align-items: start; margin-bottom: 18px; }
#preview { width: 140px; height: 170px; background: linear-gradient(#dbe7f4, #f3f7fb); border: 2px solid var(--ink); border-radius: 10px; }
.pickers label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
input { font: inherit; font-size: 15px; padding: 9px 11px; border: 2px solid var(--ink); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input:focus { outline: 3px solid #f0c040; outline-offset: 1px; }
.pick-label { display: block; font-size: 13px; font-weight: 600; margin: 4px 0 6px; }
.chars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.char { display: grid; justify-items: center; gap: 0; padding: 4px 2px 5px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; }
.char canvas { width: 48px; height: 54px; }
.char span { font-size: 11px; font-weight: 600; }
.char.on { background: #fff3c4; outline: 3px solid #f0c040; outline-offset: 1px; }
.row { display: grid; grid-template-columns: 46px 1fr; align-items: center; font-size: 13px; font-weight: 600; margin-top: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.sw { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--ink); padding: 0; }
.sw.on { outline: 3px solid #f0c040; outline-offset: 1px; }
.primary { background: var(--red); color: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 11px 16px; font-weight: 700; font-size: 15px; box-shadow: 0 3px 0 var(--ink); width: 100%; }
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.actions { display: flex; gap: 8px; margin-top: 12px; }

/* hud */
.top { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; flex-wrap: wrap; gap: 8px; z-index: 5; pointer-events: none; }
.chip { pointer-events: auto; background: var(--glass); color: #fff; border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 600; backdrop-filter: blur(4px); border: 0; }
.chip.title { background: var(--red); }
.chip.btn:hover { background: rgba(27, 22, 38, 0.86); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #5ee08a; margin-right: 6px; box-shadow: 0 0 6px #5ee08a; }

#chat { position: fixed; left: 12px; bottom: max(12px, env(safe-area-inset-bottom)); width: min(340px, calc(100% - 24px)); z-index: 5; }
#chat-log { list-style: none; margin: 0 0 6px; padding: 0; max-height: 180px; overflow-y: auto; font-size: 13px; line-height: 1.45; display: flex; flex-direction: column; gap: 2px; scrollbar-width: none; }
#chat-log li { align-self: flex-start; background: var(--glass); color: #fff; padding: 3px 9px; border-radius: 8px; max-width: 100%; word-break: break-word; }
#chat-log li b { margin-right: 6px; color: #ffd27a; }
#chat-log li.mine b { color: #ff9aa6; }
#chat-log li.sys { background: rgba(47, 107, 74, 0.78); font-size: 12px; }
#chat-input { background: rgba(255, 255, 255, 0.92); }

#emotes { position: fixed; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); display: flex; gap: 6px; z-index: 5; }
#emotes button { width: 46px; height: 46px; border-radius: 6px; border: 3px solid #a8672f; border-top-color: #eef4fb; background: #0f4c55; font-size: 20px; box-shadow: 0 0 0 2px #2a1810, 0 4px 0 2px #2a1810; }
#emotes button:hover { background: #14606b; }
#emotes button:active { transform: translateY(2px); box-shadow: 0 0 0 2px #2a1810, 0 2px 0 2px #2a1810; }

.floating { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 6; display: flex; gap: 8px; animation: bob 1.6s ease-in-out infinite; }
.ghost { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 10px; padding: 11px 14px; font-weight: 700; font-size: 15px; box-shadow: 0 3px 0 var(--ink); }
kbd { font: inherit; font-size: 11px; background: rgba(255, 255, 255, 0.25); border-radius: 4px; padding: 1px 5px; margin-left: 4px; }
@keyframes bob { 50% { transform: translateX(-50%) translateY(-4px); } }

.side { position: fixed; top: 60px; right: 12px; width: min(420px, calc(100% - 24px)); max-height: calc(100% - 140px); display: flex; flex-direction: column; border: 3px solid #2a1810; border-radius: 14px; box-shadow: 0 5px 0 #2a1810; z-index: 8; overflow: hidden;
  background: #b9824c radial-gradient(#a8743f 1px, transparent 1.5px) 0 0 / 9px 9px; }
.side header { display: flex; justify-content: space-between; align-items: flex-start; padding: 12px 14px; background: #7a4a2a; color: #fff6e6; border-bottom: 3px solid #2a1810; }
.side h2 { margin: 0; font-size: 16px; }
.side header p { margin: 2px 0 0; font-size: 12px; opacity: 0.85; }
.side footer { padding: 10px 12px; background: #7a4a2a; border-top: 3px solid #2a1810; }
#wish-list { list-style: none; margin: 0; padding: 14px 12px; overflow-y: auto; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
#wish-list li { position: relative; padding: 14px 10px 8px; font-size: 14px; line-height: 1.45; word-break: break-word; transform: rotate(var(--tilt, 0deg)); box-shadow: 0 3px 4px rgba(42, 24, 16, 0.35); min-height: 86px; display: flex; flex-direction: column; justify-content: space-between; }
#wish-list li::before { content: ""; position: absolute; top: 4px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: #d33a3a; box-shadow: inset -2px -2px 0 #9e222b; }
#wish-list li p { margin: 0 0 6px; }
#wish-list li small { font-size: 11px; color: #5a5468; }
#wish-list li small b { color: var(--green); }
#wish-list:empty { display: block; }
#wish-list:empty::after { content: "아직 걸린 소원이 없어요. 첫 소원을 걸어 보세요!"; display: block; background: #fff3a8; padding: 14px; font-size: 13px; color: var(--muted); }

#toast { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 30; max-width: calc(100% - 32px); text-align: center; }

@media (max-width: 640px) {
  .join-grid { grid-template-columns: 1fr; justify-items: center; }
  .pickers { width: 100%; }
  #chat { width: calc(100% - 24px); bottom: calc(max(12px, env(safe-area-inset-bottom)) + 56px); }
  #chat-log { max-height: 110px; }
  #emotes { left: 12px; right: 12px; justify-content: center; }
  .floating { bottom: 210px; }
  #wish-list { grid-template-columns: 1fr; }
  #toast { top: 104px; }
}

/* village button skins (assets/ui, 2x art shown at 1x) */
.vbtn { --normal: none; --hover: none; --pressed: none; --disabled: none; appearance: none; border: 0; background: transparent var(--normal) center / 100% 100% no-repeat; width: 192px; height: 64px; padding: 6px 18px 0; display: inline-grid; place-items: center; color: #fff5d8; font: 700 15px/1.2 var(--font); text-shadow: 0 2px #24312d; cursor: pointer; flex-shrink: 0; box-shadow: none; border-radius: 0; -webkit-tap-highlight-color: transparent; white-space: nowrap; }
.vbtn > span { display: inline-flex; align-items: center; gap: 4px; pointer-events: none; }
.vbtn:hover:not(:disabled) { background-image: var(--hover); }
.vbtn:active:not(:disabled) { background-image: var(--pressed); transform: none; box-shadow: none; }
.vbtn:active:not(:disabled) > span { transform: translateY(2px); }
.vbtn:disabled { background-image: var(--disabled); cursor: not-allowed; color: #dad9cf; text-shadow: 0 1px #3e4547; }
.vbtn:focus-visible { outline: 3px solid #ffda75; outline-offset: 3px; border-radius: 6px; }
.vbtn.secondary { color: #fff8e8; text-shadow: 0 1px 2px #392817, 0 1px #392817; }
.vbtn.big { width: 252px; height: 84px; font-size: 18px; padding-top: 8px; }
.vbtn.icon { width: 56px; height: 56px; padding: 0; }
.vbtn.icon.small { width: 44px; height: 44px; }
.vbtn.corner { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; }
.vbtn.primary { --normal: url("assets/ui/primary-normal.png"); --hover: url("assets/ui/primary-hover.png"); --pressed: url("assets/ui/primary-pressed.png"); --disabled: url("assets/ui/primary-disabled.png"); }
.vbtn.secondary { --normal: url("assets/ui/secondary-normal.png"); --hover: url("assets/ui/secondary-hover.png"); --pressed: url("assets/ui/secondary-pressed.png"); --disabled: url("assets/ui/secondary-disabled.png"); }
.vbtn.home { --normal: url("assets/ui/home-normal.png"); --hover: url("assets/ui/home-hover.png"); --pressed: url("assets/ui/home-pressed.png"); --disabled: url("assets/ui/home-disabled.png"); }
.vbtn.map { --normal: url("assets/ui/map-normal.png"); --hover: url("assets/ui/map-hover.png"); --pressed: url("assets/ui/map-pressed.png"); --disabled: url("assets/ui/map-disabled.png"); }
.vbtn.chat { --normal: url("assets/ui/chat-normal.png"); --hover: url("assets/ui/chat-hover.png"); --pressed: url("assets/ui/chat-pressed.png"); --disabled: url("assets/ui/chat-disabled.png"); }
.vbtn.settings { --normal: url("assets/ui/settings-normal.png"); --hover: url("assets/ui/settings-hover.png"); --pressed: url("assets/ui/settings-pressed.png"); --disabled: url("assets/ui/settings-disabled.png"); }
.vbtn.help { --normal: url("assets/ui/help-normal.png"); --hover: url("assets/ui/help-hover.png"); --pressed: url("assets/ui/help-pressed.png"); --disabled: url("assets/ui/help-disabled.png"); }
.vbtn.close { --normal: url("assets/ui/close-normal.png"); --hover: url("assets/ui/close-hover.png"); --pressed: url("assets/ui/close-pressed.png"); --disabled: url("assets/ui/close-disabled.png"); }
.vbtn kbd { background: rgba(0, 0, 0, 0.25); }
.center { display: flex; justify-content: center; }
.panel { position: relative; }

#tools { position: fixed; top: max(8px, env(safe-area-inset-top)); right: 8px; display: flex; gap: 2px; z-index: 6; }
.top { right: 420px; }
#minimap { position: fixed; top: 70px; right: 12px; z-index: 6; background: #7a4a2a; border: 3px solid #2a1810; border-radius: 10px; padding: 6px; box-shadow: 0 4px 0 #2a1810; }
#minimap canvas { display: block; width: 280px; height: 210px; border-radius: 4px; cursor: crosshair; image-rendering: pixelated; }
#minimap p { margin: 4px 2px 0; font-size: 11px; color: #fff6e6; text-align: center; }
.help-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.help-list b { display: inline-block; min-width: 92px; color: var(--green); }
.side header .vbtn { margin: -6px -6px 0 0; }
.side footer { display: flex; justify-content: center; }
.floating { gap: 4px; }
.actions { justify-content: center; }
.actions .vbtn { flex: 0 0 auto; }

@media (max-width: 640px) {
  .top { right: 12px; top: calc(max(8px, env(safe-area-inset-top)) + 48px); }
  #tools { left: 8px; right: 8px; justify-content: flex-end; }
  .vbtn.icon { width: 46px; height: 46px; }
  #tools .vbtn.icon { width: 44px; height: 44px; }
  .vbtn { width: 160px; height: 54px; font-size: 14px; }
  .vbtn.big { width: 230px; height: 76px; }
  .floating .vbtn { width: 150px; height: 50px; padding: 4px 10px 0; }
  .actions .vbtn { width: 140px; height: 48px; }
  #minimap { top: 150px; left: 50%; right: auto; transform: translateX(-50%); }
  #minimap canvas { width: 260px; height: 195px; }
  #toast { top: 150px; }
}

.vbtn.sound { --normal: url("assets/ui/sound-normal.png"); --hover: url("assets/ui/sound-hover.png"); --pressed: url("assets/ui/sound-pressed.png"); --disabled: url("assets/ui/sound-disabled.png"); }
.vbtn.sound.off { --normal: url("assets/ui/sound-disabled.png"); --hover: url("assets/ui/sound-disabled.png"); }
.chip.gift { background: rgba(200, 50, 60, 0.85); }
#now-playing { position: fixed; right: 12px; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 60px); font-size: 12px; color: rgba(27, 22, 38, 0.7); background: rgba(255, 255, 255, 0.7); padding: 3px 9px; border-radius: 999px; z-index: 4; pointer-events: none; }
@media (max-width: 640px) { #now-playing { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 112px); } .top { right: 12px; } }

/* ---------- the village noticeboard (bulletin pack) ---------- */
.noticeboard { position: fixed; z-index: 9; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(980px, calc(100vw - 24px), calc((100vh - 24px) * 4 / 3)); aspect-ratio: 4 / 3; background: url("assets/bulletin/noticeboard-panel.png") center / 100% 100% no-repeat; }
.noticeboard .nb-title { position: absolute; left: 50%; top: 20.4%; transform: translate(-50%, -50%); margin: 0; font-size: clamp(16px, 2.6vw, 26px); color: #fff3d6; text-shadow: 0 2px #4a2a14; letter-spacing: 1px; white-space: nowrap; }
.noticeboard .nb-close { position: absolute; right: 2.6%; top: 11%; }
.noticeboard .nb-content { position: absolute; left: 10.74%; top: 26.7%; width: 78.52%; height: 51.17%; display: flex; flex-direction: column; }
.nb-tabs { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.nb-tabs [role="tab"] { border: 2px solid #2a1810; border-radius: 6px; background: #7a4a2a; color: #fff3d6; font-weight: 700; font-size: 13px; padding: 5px 10px; }
.nb-tabs [role="tab"][aria-selected="true"] { background: #f6e9c8; color: #3a2a1a; }
.nb-tabs .nb-write { margin-left: auto; width: 150px; height: 50px; font-size: 14px; }
.noticeboard ul { list-style: none; margin: 0; padding: 18px 4px 6px; overflow-y: auto; flex: 1; scrollbar-width: thin; }
/* wishes: memo papers with pins */
.noticeboard #wish-list { display: grid; grid-template-columns: repeat(auto-fill, 150px); grid-auto-rows: 150px; justify-content: center; align-content: start; gap: 24px 16px; }
.noticeboard #wish-list li { position: relative; width: 150px; height: 150px; aspect-ratio: auto; min-height: 0; padding: 16% 15% 18%; background: url("assets/bulletin/memo-cream.png") center / 100% 100% no-repeat; box-shadow: none; transform: rotate(var(--tilt, 0deg)); display: flex; flex-direction: column; justify-content: space-between; font-size: 13.5px; line-height: 1.4; color: #3a2a1a; }
.noticeboard #wish-list li.memo-mint { background-image: url("assets/bulletin/memo-mint.png"); }
.noticeboard #wish-list li.memo-pink { background-image: url("assets/bulletin/memo-pink.png"); }
.noticeboard #wish-list li::before { content: ""; position: absolute; top: -14px; left: 50%; width: 26px; height: 26px; margin: 0 0 0 -13px; border-radius: 0; background: url("assets/bulletin/pin-red.png") center / contain no-repeat; box-shadow: none; }
.noticeboard #wish-list li.pin-mint::before { background-image: url("assets/bulletin/pin-mint.png"); }
.noticeboard #wish-list li p { margin: 0; overflow: hidden; word-break: break-word; }
.noticeboard #wish-list li small { font-size: 11px; color: #6a5a48; }
.noticeboard #wish-list li small b { color: #2f6b4a; }
.noticeboard #wish-list:empty::after { content: "아직 걸린 소원이 없어요. 첫 소원을 걸어 보세요!"; grid-column: 1 / -1; background: url("assets/bulletin/paper-announcement.png") center / 100% 100% no-repeat; padding: 34px 40px; color: #6a5a48; font-size: 14px; text-align: center; }
/* news: announcement papers with pictures */
.nb-news { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.nb-news li { aspect-ratio: 3 / 2; background: url("assets/bulletin/paper-announcement.png") center / 100% 100% no-repeat; padding: 9% 13% 12% 13%; color: #3a2a1a; display: flex; flex-direction: column; gap: 4px; }
.nb-news .cat { font-size: 11px; color: #8a6a48; }
.nb-news h3 { margin: 0; font-size: 15px; }
.nb-news .row { display: flex; gap: 10px; align-items: flex-start; min-height: 0; }
.nb-news img { width: 46%; aspect-ratio: 3 / 2; object-fit: cover; image-rendering: pixelated; border: 2px solid #5a3a22; }
.nb-news p { margin: 0; font-size: 12.5px; line-height: 1.45; }
.chip.gift img { width: 18px; height: 18px; vertical-align: -4px; image-rendering: pixelated; }

@media (max-width: 640px) {
  .noticeboard { width: calc(100vw - 16px); height: calc(100vh - 120px); aspect-ratio: auto; top: 54%; background: #0f4c55; border: 10px solid #7a4a2a; border-top-width: 54px; border-radius: 8px; box-shadow: 0 0 0 3px #2a1810, 0 6px 0 3px #2a1810; }
  .noticeboard .nb-title { top: -27px; font-size: 18px; }
  .noticeboard .nb-close { top: -50px; right: -4px; }
  .noticeboard .nb-content { left: 8px; top: 8px; width: calc(100% - 16px); height: calc(100% - 16px); }
  .noticeboard #wish-list { grid-template-columns: repeat(2, 140px); grid-auto-rows: 140px; gap: 22px 12px; }
  .noticeboard #wish-list li { width: 140px; height: 140px; }
  .nb-news { grid-template-columns: 1fr; }
  .nb-tabs .nb-write { width: 130px; height: 44px; font-size: 13px; }
}

/* ---------- loading screen ---------- */
#loader { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; color: #fff6e6;
  background:
    radial-gradient(2px 2px at 20% 30%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 70% 20%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 40% 70%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 85% 60%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 10% 85%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 55% 45%, #fff 50%, transparent 51%),
    linear-gradient(#141a36, #24305a 60%, #3a4a72);
  background-size: 220px 220px, 260px 260px, 180px 180px, 240px 240px, 300px 300px, 200px 200px, 100% 100%;
  animation: loader-snow 9s linear infinite; transition: opacity 0.5s ease; }
#loader.done { opacity: 0; pointer-events: none; }
@keyframes loader-snow { to { background-position: 30px 220px, -40px 260px, 20px 180px, -20px 240px, 40px 300px, 0 200px, 0 0; } }
.loader-card { width: min(360px, 100%); text-align: center; }
.loader-logo { font-size: 40px; font-weight: 800; letter-spacing: -1px; text-shadow: 0 3px 0 #0b0f22, 0 0 24px rgba(255, 220, 140, 0.35); margin-bottom: 22px; }
.loader-logo .flake, .join-head .flake { display: inline-block; margin-right: 8px; animation: flake-spin 6s linear infinite; }
@keyframes flake-spin { to { transform: rotate(360deg); } }
.loader-bar { height: 18px; border-radius: 4px; border: 3px solid #a8672f; border-top-color: #eef4fb; background: #0f2a30; box-shadow: 0 0 0 2px #2a1810, 0 4px 0 2px #2a1810; overflow: hidden; }
#load-fill { display: block; height: 100%; width: 0; background: repeating-linear-gradient(-45deg, #2c8a7a 0 8px, #3aa892 8px 16px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35); transition: width 0.2s ease; }
#load-text { margin: 12px 0 4px; font-size: 14px; font-weight: 600; }
.loader-tip { margin: 0; font-size: 12px; opacity: 0.75; min-height: 1.4em; }

/* ---------- character creation ---------- */
.join-wrap { background: linear-gradient(rgba(16, 22, 48, 0.55), rgba(16, 22, 48, 0.25)); backdrop-filter: blur(1.5px); }
.join-panel { width: min(640px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 30px 26px 20px; border-radius: 10px; border: 0;
  background: linear-gradient(#fdf9f0, #f4ecdc);
  box-shadow: 0 0 0 4px #a8672f, 0 0 0 7px #6b3f22, 0 0 0 10px #2a1810, 0 12px 0 10px #2a1810, 0 18px 40px rgba(0, 0, 0, 0.45); }
/* a cap of snow along the top edge */
.join-panel::before { content: ""; position: absolute; left: -12px; right: -12px; top: -18px; height: 26px; pointer-events: none;
  background:
    radial-gradient(14px 12px at 12px 16px, #f4f8fc 98%, transparent) 0 0 / 40px 26px repeat-x,
    linear-gradient(#f4f8fc, #f4f8fc) 0 14px / 100% 10px no-repeat;
  filter: drop-shadow(0 2px 0 #c8d6ea); border-radius: 12px 12px 0 0; }
.join-head { text-align: center; margin-bottom: 16px; }
.join-head h1 { margin: 0; font-size: 30px; letter-spacing: -0.5px; color: #2a1810; }
.join-head .sub { margin: 6px auto 8px; max-width: 440px; }
.join-meta { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.join-meta span:empty { display: none; }
.join-meta span { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #0f4c55; color: #fff6e6; }
.join-meta span + span { background: #2f6b4a; }
.join-panel .join-grid { grid-template-columns: 220px 1fr; gap: 20px; margin-bottom: 18px; align-items: stretch; }
.stage { display: flex; flex-direction: column; align-items: center; }
.stage-name { font-size: 13px; font-weight: 700; color: #fff; background: #c8323c; padding: 3px 12px; border-radius: 999px; margin-bottom: -10px; z-index: 1; position: relative; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.join-panel #preview { width: 220px; height: 250px; border: 0; border-radius: 8px; background: transparent; box-shadow: 0 0 0 3px #a8672f, 0 0 0 5px #2a1810; }
.stage-turn { display: flex; align-items: center; justify-content: space-between; width: 220px; margin-top: 10px; gap: 6px; }
.stage-turn button { width: 34px; height: 34px; border-radius: 6px; border: 3px solid #a8672f; border-top-color: #eef4fb; background: #0f4c55; color: #fff6e6; font-size: 13px; box-shadow: 0 0 0 2px #2a1810, 0 3px 0 2px #2a1810; }
.stage-turn button:active { transform: translateY(2px); box-shadow: 0 0 0 2px #2a1810, 0 1px 0 2px #2a1810; }
.stage-role { font-size: 13px; font-weight: 700; color: #2a1810; }
.pickers .field { font-size: 13px; font-weight: 700; display: block; margin-bottom: 4px; }
.name-row { display: flex; gap: 6px; margin-bottom: 12px; }
.name-row input { flex: 1; min-width: 0; border-color: #6b3f22; background: #fffdf8; }
.dice { width: 44px; flex: 0 0 44px; border-radius: 8px; border: 2px solid #6b3f22; background: #fff3c4; font-size: 20px; box-shadow: 0 3px 0 #6b3f22; }
.dice:active { transform: translateY(2px); box-shadow: 0 1px 0 #6b3f22; }
.dice.roll { animation: dice-roll 0.4s ease; }
@keyframes dice-roll { 50% { transform: rotate(180deg) scale(1.15); } }
.join-panel .chars { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.join-panel .char { position: relative; padding: 8px 2px 6px; border-radius: 6px; border: 3px solid #a8672f; border-top-color: #eef4fb; background: linear-gradient(#e6f0fa, #f8fbff 70%); box-shadow: 0 0 0 2px #2a1810, 0 4px 0 2px #2a1810; transition: transform 0.12s ease; }
.join-panel .char:hover { transform: translateY(-2px); }
.join-panel .char canvas { width: 54px; height: 61px; }
.join-panel .char span { font-size: 12px; font-weight: 700; color: #2a1810; }
.join-panel .char.on { background: linear-gradient(#fff3c4, #fffaf0 70%); outline: 0; transform: translateY(-3px); box-shadow: 0 0 0 2px #2a1810, 0 5px 0 2px #2a1810, 0 0 0 5px #f0c040, 0 0 18px 4px rgba(240, 192, 64, 0.55); }
.join-panel .char.on::after { content: "✔"; position: absolute; top: -9px; right: -7px; width: 20px; height: 20px; border-radius: 50%; background: #2f6b4a; color: #fff; font-size: 11px; line-height: 20px; box-shadow: 0 0 0 2px #2a1810; }
.char-desc { margin: 12px 0 0; font-size: 13px; color: var(--muted); min-height: 2.6em; line-height: 1.4; }

@media (max-width: 640px) {
  .join-panel { padding: 26px 16px 16px; }
  .join-head h1 { font-size: 24px; }
  .join-head .sub { font-size: 13px; }
  .join-panel .join-grid { grid-template-columns: 1fr; gap: 12px; }
  .join-panel #preview { width: 160px; height: 182px; }
  .stage-turn { width: 180px; }
  .join-panel .char canvas { width: 46px; height: 52px; }
  .char-desc { min-height: 0; }
}

/* moderation: the name menu in the chat, and the "you've been sent out" screen */
#chat-log li b[tabindex] { cursor: pointer; text-decoration: underline dotted rgba(255, 210, 122, 0.5); text-underline-offset: 3px; }
.who-menu { position: fixed; z-index: 40; display: flex; flex-direction: column; gap: 4px; min-width: 170px; padding: 8px; background: var(--ink); color: #fff; border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); font-size: 13px; }
.who-menu b { padding: 2px 6px 4px; color: #ffd27a; }
.who-menu button { text-align: left; padding: 7px 8px; border: 0; border-radius: 6px; background: rgba(255, 255, 255, 0.08); color: inherit; font: inherit; cursor: pointer; }
.who-menu button:hover, .who-menu button:focus-visible { background: rgba(255, 255, 255, 0.18); }
#kicked { z-index: 60; }

/* advent calendar: the toolbar button (with a dot while today's door is shut) and the 25 doors */
.vbtn.calendar { --normal: url("assets/ui/calendar-normal.png"); --hover: url("assets/ui/calendar-hover.png"); --pressed: url("assets/ui/calendar-pressed.png"); --disabled: url("assets/ui/calendar-disabled.png"); position: relative; }
.vbtn.calendar.dot::after { content: ""; position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; border-radius: 50%; background: #e2463d; border: 2px solid #fff5d8; animation: advent-blink 1.6s ease-in-out infinite; }
@keyframes advent-blink { 50% { transform: scale(1.25); } }
.advent-panel { width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; }
.advent-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 14px 0; }
.door { position: relative; aspect-ratio: 1; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 10px; font: inherit; color: var(--ink); cursor: pointer; padding: 0; background: #f6ead2; box-shadow: 0 3px 0 var(--ink); transition: transform 0.12s; }
.door .num { position: absolute; top: 4px; left: 7px; font-weight: 800; font-size: 13px; }
.door .emo { font-size: clamp(20px, 6vw, 30px); line-height: 1; }
.door.locked, .door.missed { cursor: default; box-shadow: 0 2px 0 rgba(27, 22, 38, 0.5); border-color: rgba(27, 22, 38, 0.5); }
.door.locked { background: repeating-linear-gradient(45deg, #e8dcc2 0 8px, #e2d4b6 8px 16px); }
.door.locked .emo { font-size: 16px; opacity: 0.55; }
.door.missed { background: #d9d4cc; color: rgba(27, 22, 38, 0.5); }
.door.missed .emo { font-size: 16px; opacity: 0.6; }
.door.today { background: #c0392b; color: #fff5d8; animation: advent-glow 1.4s ease-in-out infinite; }
.door.today .cta { font-weight: 800; font-size: 14px; margin-top: 10px; }
.door.today:hover { transform: translateY(-2px); }
.door.opening { animation: advent-open 0.5s ease-in forwards; }
.door.open { background: #fff9ec; }
.door.open .stamp { position: absolute; right: 4px; bottom: 3px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-size: 11px; font-weight: 800; transform: rotate(-12deg); }
.door.open:hover { transform: translateY(-2px); }
@keyframes advent-glow { 50% { box-shadow: 0 3px 0 var(--ink), 0 0 0 5px rgba(255, 210, 122, 0.75); } }
@keyframes advent-open { to { transform: perspective(300px) rotateY(-80deg); opacity: 0.4; } }
.advent-progress { display: grid; gap: 8px; }
.advent-row { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 14px; }
.advent-next { margin-left: auto; color: rgba(27, 22, 38, 0.65); font-size: 13px; }
.advent-track { height: 10px; border-radius: 999px; background: rgba(27, 22, 38, 0.12); overflow: hidden; }
.advent-track span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #c0392b, #e8a33d); border-radius: inherit; transition: width 0.5s; }
.advent-titles { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.advent-titles li { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: rgba(27, 22, 38, 0.08); color: rgba(27, 22, 38, 0.5); }
.advent-titles li.got { background: var(--green); color: #fff; }
.advent-titles small { margin-left: 4px; opacity: 0.75; }
.advent-foot { margin: 12px 0 0; font-size: 12px; color: rgba(27, 22, 38, 0.6); }
.advent-reveal { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px; border: 0; border-radius: 11px; background: rgba(255, 249, 236, 0.97); color: var(--ink); font: inherit; text-align: center; cursor: pointer; }
.advent-reveal .emo { font-size: 72px; line-height: 1.1; }
.advent-reveal b { font-size: 22px; }
.advent-reveal small { color: rgba(27, 22, 38, 0.6); }
.advent-reveal .tap { margin-top: 10px; font-size: 12px; }
.advent-reveal.pop .emo { animation: advent-pop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes advent-pop { from { transform: scale(0.2) rotate(-20deg); opacity: 0; } }
@media (max-width: 640px) {
  .advent-grid { gap: 6px; }
  .door .num { font-size: 11px; top: 2px; left: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  .vbtn.calendar.dot::after, .door.today, .door.opening, .advent-reveal.pop .emo { animation: none; }
}

/* snowballs, photos and Christmas midnight */
#emotes button.tool-alt { background: #7a3a2a; }
#emotes button.tool-alt:hover { background: #8f4632; }
.photo-panel { width: min(760px, 100%); }
#photo-img { display: block; width: 100%; height: auto; margin: 10px 0 14px; border-radius: 6px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25); }
#photo-save { text-decoration: none; }
#flash { position: fixed; inset: 0; z-index: 70; background: #fff; pointer-events: none; animation: flash 0.45s ease-out forwards; }
@keyframes flash { from { opacity: 0.9; } to { opacity: 0; } }
#xmas-overlay { position: fixed; inset: 0; z-index: 25; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; pointer-events: none; color: #fff; text-shadow: 0 4px 0 #1b1626, 0 0 24px rgba(255, 210, 122, 0.8); }
#xmas-big { font-size: clamp(64px, 18vw, 180px); font-weight: 900; line-height: 1; }
#xmas-big.word { font-size: clamp(36px, 9vw, 88px); }
#xmas-big.tick { animation: xmas-tick 1s ease-out; }
#xmas-small { font-size: clamp(14px, 3vw, 20px); font-weight: 700; }
@keyframes xmas-tick { from { transform: scale(1.8); opacity: 0.2; } 30% { transform: scale(1); opacity: 1; } }
@media (max-width: 640px) {
  #emotes { gap: 4px; }
  #emotes button { width: 40px; height: 40px; font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  #flash, #xmas-big.tick { animation: none; }
  #flash { opacity: 0; }
}

/* ---------- the chief's notice: a sealed scroll that unrolls from the top ---------- */
#notice-banner { position: fixed; z-index: 31; top: 58px; left: 50%; width: min(520px, calc(100vw - 24px)); min-height: calc(min(520px, 100vw - 24px) * 0.5); transform: translateX(-50%); background: url("assets/bulletin/paper-announcement.png") center / 100% 100% no-repeat; padding: 44px 13% 46px; box-sizing: border-box; text-align: center; color: #3a2312; filter: drop-shadow(0 6px 0 rgba(42, 24, 16, 0.55)) drop-shadow(0 0 22px rgba(255, 210, 110, 0.65)); transform-origin: 50% 0; }
#notice-banner.show { animation: nt-unroll 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) both, nt-glow 2.4s 0.7s ease-in-out infinite; }
#notice-banner .nt-ribbon { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); background: #b3262e; color: #fff3d6; font-weight: 700; font-size: 15px; letter-spacing: 1px; padding: 5px 22px; white-space: nowrap; box-shadow: 0 0 0 3px #5a1015, 0 4px 0 3px #2a1810; clip-path: polygon(0 0, 100% 0, 94% 50%, 100% 100%, 0 100%, 6% 50%); }
#notice-banner p { margin: 0 0 8px; font-size: clamp(15px, 3.4vw, 20px); font-weight: 700; line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere; }
#notice-banner p.long { font-size: clamp(14px, 3vw, 17px); }
#notice-banner .nt-sign { font-size: 12px; color: #7a5232; }
#notice-banner .nt-seal { position: absolute; right: 6%; bottom: 34px; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #e0484f, #9a1a22 70%); color: #ffd9c2; font-size: 17px; line-height: 34px; box-shadow: 0 2px 0 #5a1015; transform: rotate(-12deg); }
#notice-close { position: absolute; top: 6%; right: 5%; border: 0; background: none; color: #7a5232; font-size: 15px; cursor: pointer; padding: 4px; }
@keyframes nt-unroll { from { transform: translateX(-50%) scaleY(0.05); opacity: 0; } to { transform: translateX(-50%) scaleY(1); opacity: 1; } }
@keyframes nt-glow { 50% { filter: drop-shadow(0 6px 0 rgba(42, 24, 16, 0.55)) drop-shadow(0 0 34px rgba(255, 210, 110, 0.95)); } }
#chat-log li.sys.notice { background: linear-gradient(90deg, #8a5a12, #b8862a); color: #fff7dc; font-weight: 700; font-size: 13px; box-shadow: 0 0 0 2px #ffd27a inset; }
.noticeboard #news-list li.chief { filter: drop-shadow(0 0 2px #b3262e) drop-shadow(0 0 8px rgba(255, 200, 90, 0.9)); }
.noticeboard #news-list li.chief .cat { color: #b3262e; font-weight: 700; }
@media (max-width: 640px) { #notice-banner { top: 100px; } }

/* ---------- ❤️ on a wish memo ---------- */
.noticeboard #wish-list li .heart { position: absolute; right: 12%; bottom: 13%; border: 0; background: rgba(255, 255, 255, 0.55); border-radius: 999px; padding: 1px 7px; font: 700 12px/1.5 var(--font); color: #8a2a34; cursor: pointer; }
.noticeboard #wish-list li .heart:hover { background: rgba(255, 255, 255, 0.85); }
.noticeboard #wish-list li .heart.on { background: rgba(255, 200, 205, 0.85); }
.noticeboard #wish-list li .heart.pop { animation: heart-pop 0.35s ease-out; }
.noticeboard #wish-list li small { padding-right: 44px; }
@keyframes heart-pop { 50% { transform: scale(1.35); } }
.loader-about { margin: 18px auto 0; max-width: 320px; font-size: 12px; line-height: 1.6; opacity: 0.6; }

/* languages: the picker under the join title, and the news cards' translated headings */
.langs { display: flex; justify-content: center; gap: 4px; margin-top: 8px; }
.langs a { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; color: #3a2a1a; text-decoration: none; border: 1px solid rgba(58, 42, 26, 0.25); }
.langs a:hover { background: rgba(58, 42, 26, 0.08); }
.langs a[aria-current="true"] { background: #3a2a1a; color: #fff6e6; border-color: #3a2a1a; }
.nb-news li > div:first-child { display: contents; }
#emotes button#sit-btn[aria-pressed="true"] { background: #2f6b4a; border-top-color: #ffd27a; }
