/* Layout: one full-screen 3D stage; HUD panels pinned to the four corners. Single dark theme by choice. */
  :root {
    color-scheme: dark;
    --ink: #0b0d1c;
    --panel: rgba(14, 12, 28, 0.78);
    --line: rgba(232, 196, 120, 0.38);
    --gold: #e8c478;
    --paper: #f3ead8;
    --muted: #a9a3b8;
    --red: #d2473c;
    --font-display: "Gowun Batang", "Nanum Myeongjo", "Batang", serif;
    --font-body: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  }
  * { box-sizing: border-box; }
  html, body { height: 100%; margin: 0; }
  body {
    background: var(--ink);
    color: var(--paper);
    font-family: var(--font-body);
    font-size: 14px;
    overflow: hidden;
  }
  #stage { position: relative; width: 100%; height: 100%; }
  /* 모바일에서 누를 때 화면이 파랗게 깜빡이지 않게 한다 */
  html, body, #stage, canvas { -webkit-tap-highlight-color: transparent; }
  #stage { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  #chatInput { -webkit-user-select: text; user-select: text; }
  #c { display: block; width: 100%; height: 100%; touch-action: none; cursor: pointer; outline: none; }

  .hud { position: absolute; pointer-events: none; display: flex; gap: 10px; }
  .hud > * { pointer-events: auto; }
  .panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 12px;
    backdrop-filter: blur(4px);
  }
  #hud-tl { top: 16px; left: 16px; flex-direction: column; align-items: flex-start; }
  #hud-tr { top: 16px; right: 16px; flex-direction: column; align-items: flex-end; }
  #hud-bl { bottom: 16px; left: 16px; flex-direction: column; align-items: flex-start; }
  #hud-br { bottom: 16px; right: 16px; flex-direction: column; align-items: flex-end; }
  @media (max-width: 900px) { #hud-br { display: none; } }

  .gate {
    font-family: var(--font-display);
    display: flex; align-items: baseline; gap: 10px;
  }
  .gate b { font-size: 26px; color: var(--gold); font-variant-numeric: tabular-nums; }
  .gate span { font-size: 15px; color: var(--paper); }
  .tag { font-size: 12px; color: var(--muted); }
  .stat { display: flex; gap: 8px; align-items: baseline; font-variant-numeric: tabular-nums; }
  .stat b { font-size: 17px; color: var(--gold); font-weight: 700; }
  .stat small { font-size: 12px; color: var(--muted); }

  .hint { font-size: 12px; color: var(--muted); text-align: right; max-width: 300px; line-height: 1.5; }

  #result {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    pointer-events: none;
    opacity: 0; transition: opacity 0.25s ease;
    font-family: var(--font-display);
    text-align: center;
  }
  #result.show { opacity: 1; }
  #result .big { font-size: clamp(44px, 9vw, 96px); font-weight: 700; letter-spacing: 0.08em; }
  #result .sub { font-size: clamp(15px, 2.4vw, 22px); color: var(--paper); }
  #result.pass { background: radial-gradient(circle, rgba(255, 214, 120, 0.28), rgba(0, 0, 0, 0) 62%); }
  #result.pass .big { color: #ffe08a; text-shadow: 0 0 28px rgba(255, 200, 80, 0.8); }
  #result.fail { background: radial-gradient(circle, rgba(170, 20, 20, 0.5), rgba(20, 0, 0, 0.55) 70%); }
  #result.fail .big { color: #ff6a5a; text-shadow: 0 0 28px rgba(255, 60, 40, 0.8); }

  #result.amulet { background: radial-gradient(circle, rgba(242, 211, 79, 0.22), rgba(0, 0, 0, 0) 62%); }
  #result.amulet .big { color: #f2d34f; text-shadow: 0 0 24px rgba(242, 211, 79, 0.7); }
  #result.fever .big { letter-spacing: 0.2em; }
  .nick { font-size: 13px; color: var(--paper); }

  #chatWrap { bottom: 16px; left: 16px; flex-direction: column; align-items: flex-start; width: min(330px, 42%); }
  #chatWrap .chat { background: rgba(14, 12, 28, 0.55); }
  #chatWrap:focus-within .chat { background: var(--panel); }
  .chat { width: 100%; display: flex; flex-direction: column; gap: 6px; }
  #chatLog { height: 92px; overflow-y: auto; font-size: 13px; line-height: 1.5; overscroll-behavior: contain; }
  #chatLog p { margin: 0; overflow-wrap: anywhere; }
  #chatLog .who { font-weight: 700; }
  #chatLog .sys { color: var(--gold); }
  #chatLog .door-fail { color: #ff8a7a; }
  #chatLog .door-pass { color: #a6e3a8; }
  #chatForm { display: flex; gap: 6px; }
  #chatInput {
    flex: 1; min-width: 0;
    font: 14px var(--font-body); color: var(--paper);
    background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px;
  }
  #chatInput::placeholder { color: var(--muted); }
  #chatInput:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
  #chatSend, #chatToggle {
    font: 500 13px var(--font-body); color: #20160a;
    background: var(--gold); border: 0; border-radius: 4px; padding: 8px 12px; cursor: pointer;
  }
  #chatSend:focus-visible, #chatToggle:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
  #chatToggle { display: none; }

  #fade, #vignette { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
  #warp { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; }
  #vignette { background: radial-gradient(circle, rgba(120, 0, 0, 0) 38%, rgba(150, 8, 0, 0.78) 100%); }
  #result.reborn .big { color: #ffffff; text-shadow: 0 0 26px rgba(255, 255, 255, 0.85); letter-spacing: 0.2em; }

  .mini {
    font: 500 12px var(--font-body); color: var(--paper);
    background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
    padding: 7px 10px; cursor: pointer;
  }
  .mini:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

  .minis { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 230px; }

  #guide, #shop, #rank, #link, #share, #daily {
    position: absolute; inset: 0; z-index: 5;
    display: flex; align-items: center; justify-content: center; padding: 16px;
    background: rgba(6, 5, 14, 0.72);
  }
  #guide[hidden], #shop[hidden], #rank[hidden], #link[hidden], #share[hidden], #daily[hidden] { display: none; }
  #rankTabs { display: flex; gap: 6px; margin-bottom: 10px; }
  #rankTabs button {
    flex: 1; font: 500 13px var(--font-body); color: var(--paper);
    background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 7px 6px; cursor: pointer;
  }
  #rankTabs button[aria-pressed="true"] { background: var(--gold); color: #20160a; border-color: var(--gold); }
  #rankList { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow-y: auto; overscroll-behavior: contain; }
  #rankList li {
    display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: baseline;
    padding: 8px 6px; border-top: 1px solid var(--line); font-size: 14px; font-variant-numeric: tabular-nums;
  }
  #rankList li.rank-empty { display: block; color: var(--muted); }
  #rankList .no { font-weight: 700; color: #d9d4e4; }
  #rankList li.top .no { color: var(--gold); }
  #rankList li.idle { color: var(--muted); }
  #rankList li.idle .no { color: var(--muted); font-weight: 400; }
  #rankList li.me { background: rgba(232, 196, 120, 0.14); }
  #rankList .who { min-width: 0; overflow-wrap: anywhere; }
  #rankList .who small { margin-left: 6px; font-size: 11px; color: var(--gold); }
  #rankList .fl { color: #c9c3d6; white-space: nowrap; }
  #rankMe { margin: 12px 0 6px; font-size: 13px; color: var(--gold); min-height: 20px; }
  #rankSeason { margin: 0 0 12px; font-size: 12px; line-height: 1.5; color: var(--muted); }
  #rank button:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
  .shop-item {
    display: flex; gap: 14px; align-items: center; justify-content: space-between;
    padding: 12px 0; border-top: 1px solid var(--line);
  }
  .shop-item h2 { margin: 0 0 3px; font: 700 17px var(--font-display); color: var(--paper); }
  .shop-item p { margin: 0; font-size: 13px; line-height: 1.5; color: #c9c3d6; }
  .shop-item .held { margin-top: 4px; color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
  .shop-item button {
    flex: none; min-width: 104px;
    font: 700 14px var(--font-body); color: #20160a; font-variant-numeric: tabular-nums;
    background: var(--gold); border: 0; border-radius: 6px; padding: 10px 12px; cursor: pointer;
  }
  .shop-item button:disabled { background: #4a4660; color: #a9a3b8; cursor: default; }
  .shop-item button:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
  .shop-sub { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font: 700 19px var(--font-display); color: var(--gold); }
  .shop-sub small { font: 400 12px var(--font-body); color: var(--muted); margin-left: 6px; }
  .shop-group { margin: 16px 0 0; font: 700 13px var(--font-body); color: var(--muted); letter-spacing: 0.04em; }
  .shop-group + .shop-item { border-top: 0; padding-top: 6px; }
  #megaText, #linkInput {
    width: 100%; margin-top: 8px;
    font: 14px var(--font-body); color: var(--paper);
    background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px;
    -webkit-user-select: text; user-select: text;
  }
  #megaText:focus-visible, #linkInput:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
  #chatLog .shout { color: #ffe9a8; background: rgba(232, 196, 120, 0.14); border-radius: 3px; padding: 1px 4px; }
  #shout {
    position: absolute; left: 50%; top: 16px; transform: translateX(-50%);
    max-width: min(560px, calc(100% - 32px));
    background: rgba(40, 28, 6, 0.92); border: 1px solid var(--gold); border-radius: 6px;
    padding: 9px 14px; font-size: 14px; font-weight: 700; color: #ffe9a8; text-align: center; overflow-wrap: anywhere;
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease; z-index: 4;
  }
  #shout.show { opacity: 1; }
  /* 꾸미기 창: 넓은 화면은 오른쪽, 좁은 화면은 아래쪽에 붙는다. 남은 자리로 내 혼령이 보인다. */
  #dress {
    position: absolute; top: 0; right: 0; bottom: 0; z-index: 5;
    width: min(370px, 100%);
    display: flex; flex-direction: column; gap: 10px; padding: 16px;
    background: rgba(20, 18, 42, 0.95); border-left: 1px solid var(--line);
  }
  #dress[hidden] { display: none; }
  .dress-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .dress-head h1 { margin: 0; font: 700 24px var(--font-display); color: var(--gold); }
  .dress-gold { margin: 0; font-size: 13px; color: #d9d4e4; font-variant-numeric: tabular-nums; }
  .dress-gold b { color: var(--gold); }
  #dressTabs { display: flex; gap: 6px; }
  #dressTabs button {
    flex: 1; font: 500 13px var(--font-body); color: var(--paper);
    background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 7px 6px; cursor: pointer;
  }
  #dressTabs button[aria-pressed="true"] { background: var(--gold); color: #20160a; border-color: var(--gold); }
  #dressList { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
  .dress-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 6px; border-top: 1px solid var(--line); }
  .dress-row.trying { background: rgba(232, 196, 120, 0.13); }
  .dress-row.worn h2 { color: var(--gold); }
  .dress-info { min-width: 0; }
  .dress-info h2 { margin: 0 0 2px; font: 700 15px var(--font-body); color: var(--paper); display: flex; align-items: center; gap: 8px; }
  .dress-info p { margin: 0; font-size: 12px; line-height: 1.45; color: #c9c3d6; font-variant-numeric: tabular-nums; }
  .chip { flex: none; width: 34px; height: 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.35); }
  .dress-acts { flex: none; display: flex; flex-direction: column; gap: 5px; }
  .dress-acts button {
    min-width: 76px; font: 700 12px var(--font-body); color: #20160a;
    background: var(--gold); border: 1px solid var(--gold); border-radius: 5px; padding: 6px 8px; cursor: pointer;
  }
  .dress-acts button.ghost { background: transparent; color: var(--paper); border-color: var(--line); }
  .dress-acts button:disabled { background: #4a4660; border-color: #4a4660; color: #a9a3b8; cursor: default; }
  #dress button:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
  #dressMsg { min-height: 34px; margin: 0; font-size: 12px; line-height: 1.45; color: var(--gold); }
  @media (max-width: 620px) {
    #dress { top: auto; left: 0; width: 100%; height: 48%; border-left: 0; border-top: 1px solid var(--line); }
  }

  #shopMsg { min-height: 21px; margin: 12px 0; font-size: 13px; color: var(--gold); border-top: 1px solid var(--line); padding-top: 12px; }
  .guide-card {
    width: min(460px, 100%); max-height: 100%; overflow-y: auto;
    background: #14122a; border: 1px solid var(--line); border-radius: 10px;
    padding: 24px 24px 20px;
  }
  .guide-card h1 { margin: 0 0 10px; font: 700 28px var(--font-display); color: var(--gold); text-wrap: balance; }
  .guide-lead { margin: 0 0 12px; font-size: 15px; line-height: 1.6; }
  .guide-card ul { margin: 0 0 18px; padding-left: 18px; display: grid; gap: 7px; font-size: 14px; line-height: 1.55; color: #d9d4e4; }
  #guideClose {
    width: 100%; font: 700 16px var(--font-body); color: #20160a;
    background: var(--gold); border: 0; border-radius: 6px; padding: 12px; cursor: pointer;
  }
  #guideClose:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }

  #toast {
    position: absolute; left: 50%; top: 84px; transform: translateX(-50%);
    max-width: calc(100% - 32px);
    background: var(--panel); border: 1px solid var(--red); border-radius: 6px;
    padding: 9px 14px; font-size: 13px; text-align: center;
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
  }
  #toast.show { opacity: 1; }

  #fallback {
    position: absolute; inset: 0; display: none;
    align-items: center; justify-content: center; padding: 24px; text-align: center;
    font-family: var(--font-display); font-size: 18px; line-height: 1.6;
  }

  @media (max-width: 620px) {
    #hud-br { display: none; }
    #chatWrap { width: min(330px, calc(100% - 32px)); }
    #chatLog { height: 58px; }
    #chatInput { font-size: 16px; }
    #chatForm { display: none; }
    #chatWrap.open #chatForm { display: flex; }
    #chatToggle { display: block; }
    #chatWrap.open #chatToggle { display: none; }
    .gate b { font-size: 22px; }
  }
  @media (prefers-reduced-motion: reduce) {
    #result { transition: none; }
  }

  /* 낚시 창: 물이 보이도록 화면 아래쪽에 낮게 깔린다. 어망과 도감은 눌러야 펼쳐진다 */
  #fish {
    position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 4;
    width: min(380px, calc(100% - 16px));
    background: rgba(20, 18, 42, 0.9); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 10px;
    display: flex; flex-direction: column; gap: 6px;
  }
  #fish[hidden] { display: none; }
  .fish-top { display: flex; align-items: center; gap: 6px; }
  .fish-top b { font: 700 15px var(--font-display); color: var(--gold); }
  #fishCasts { flex: 1; font-size: 12px; color: var(--gold); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .fish-tab {
    font: 500 12px var(--font-body); color: var(--paper); background: transparent;
    border: 1px solid var(--line); border-radius: 999px; padding: 6px 9px; cursor: pointer; white-space: nowrap;
  }
  .fish-tab[aria-expanded="true"] { background: var(--gold); color: #20160a; border-color: var(--gold); }
  #fishStatus { margin: 0; min-height: 20px; font-size: 14px; font-weight: 700; color: var(--paper); text-align: center; }
  #fishMain, #fishSell {
    font: 700 16px var(--font-body); color: #20160a; background: var(--gold);
    border: 0; border-radius: 8px; padding: 13px 12px; cursor: pointer; touch-action: none;
  }
  #fishSell { font-size: 14px; padding: 10px 12px; width: 100%; }
  #fishMain:disabled, #fishSell:disabled { background: #4a4660; color: #a9a3b8; cursor: default; }
  #fishMain.bite { background: #ff5a3c; color: #fff; }
  #fishMain.fight { background: #9fe0d8; color: #0d2a2a; }
  #fishMain.fight:active { background: #6fc9be; }
  #fish button:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
  .fish-level { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; font-size: 12px; color: var(--paper); font-variant-numeric: tabular-nums; }
  .fish-level .fish-track { height: 8px; }
  #fishXp { background: var(--gold); }
  .fish-level small { color: var(--muted); }
  /* 어부 앞에서 연 창에는 던지기 버튼과 남은 횟수가 없다 */
  #fish.shop #fishMain, #fish.shop #fishCasts { display: none; }
  #fish.shop .fish-top b::after { content: " · 삼도천 어부"; font-weight: 500; font-size: 12px; color: var(--muted); }
  #fishBars { display: grid; gap: 4px; }
  #fishBars[hidden] { display: none; }
  .fish-bar { display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
  .fish-track { height: 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line); overflow: hidden; }
  .fish-track i { display: block; height: 100%; width: 0; border-radius: 999px; }
  #fishTension { background: #8fe0a0; }
  #fishTension.warn { background: #ffd76a; }
  #fishTension.danger { background: #ff5a3c; }
  #fishProgress { background: #7cc4ff; }
  #fishBagBox[hidden], #fishDexBox[hidden] { display: none; }
  #fishList, #fishDex { list-style: none; margin: 0 0 6px; padding: 0; max-height: 150px; overflow-y: auto; overscroll-behavior: contain; }
  #fishList li {
    display: grid; grid-template-columns: 48px 1fr auto; gap: 8px; align-items: center;
    padding: 3px 0; border-top: 1px solid var(--line); font-size: 13px; font-variant-numeric: tabular-nums;
  }
  #fishList li.fish-empty { display: block; padding: 8px 0; color: var(--muted); }
  #fishList canvas, #fishDex canvas { width: 48px; height: 29px; }
  #fishDex { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; max-height: 190px; }
  #fishDex li { display: grid; justify-items: center; gap: 1px; padding: 5px 2px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; text-align: center; }
  #fishDex li small { font-size: 11px; color: var(--muted); }
  .fish-note { margin: 0; font-size: 11px; color: var(--muted); }
  /* 낚은 물고기를 보여 주는 카드 */
  #fishCard {
    position: absolute; left: 50%; top: 22%; transform: translateX(-50%); z-index: 4; pointer-events: none;
    width: min(260px, calc(100% - 32px)); display: grid; justify-items: center; gap: 2px; text-align: center;
    background: rgba(20, 18, 42, 0.92); border: 1px solid var(--gold); border-radius: 12px; padding: 10px 14px 12px;
  }
  #fishCard[hidden] { display: none; }
  #fishCard canvas { width: 200px; height: 113px; }
  #fishCard b { font: 700 20px var(--font-display); }
  #fishCard span { font-size: 13px; color: var(--gold); font-variant-numeric: tabular-nums; }
  #fishCard small { font-size: 12px; color: #c9c3d6; line-height: 1.5; }
  /* 낚시하는 동안 좁은 화면에서는 채팅 창을 치워 물이 보이게 한다 */
  @media (max-width: 620px) {
    #stage.fishing #chatWrap { display: none; }
    #fish { bottom: 8px; }
  }
  @media (min-width: 621px) and (max-width: 1100px) {
    #fish { left: auto; right: 12px; transform: none; }
  }

  /* 오른쪽 위 정보: 넓은 화면에서는 세로로 쌓는다 */
  .stats { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
  .stat .short { display: none; }
  #menuBtn { display: none; }

  /* 좁은 화면(휴대폰): 맨 위 한 줄에 층 정보와 메뉴 버튼, 그 아래 한 줄에 수치 네 칸. 나머지 버튼은 메뉴 안에 넣는다 */
  @media (max-width: 620px) {
    #hud-tl { top: 8px; left: 8px; right: 78px; }
    #hud-tl .panel { width: 100%; padding: 6px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    #hud-tl .gate { gap: 8px; }
    #hud-tl .gate b { font-size: 19px; }
    #hud-tl .gate span { font-size: 13px; }
    #hud-tl .nick, #hud-tl #best { display: inline; font-size: 11px; }
    #hud-tl #best::before { content: " · "; }

    #hud-tr { top: 8px; left: 8px; right: 8px; align-items: stretch; gap: 0; }
    #menuBtn { display: block; position: absolute; top: 0; right: 0; width: 64px; height: 52px; font-size: 14px; font-weight: 700; }
    .stats { flex-direction: row; align-items: stretch; gap: 6px; margin-top: 58px; }
    .stats .stat { flex: 1 1 0; min-width: 0; flex-direction: column; align-items: center; gap: 0; padding: 4px 2px; }
    .stat small { font-size: 10px; }
    .stat b { font-size: 15px; }
    .stat .unit, .stat .long { display: none; }
    .stat .short { display: inline; }

    .minis { display: none; position: absolute; top: 58px; right: 0; z-index: 3; max-width: none; width: 150px;
      flex-direction: column; flex-wrap: nowrap; gap: 6px; padding: 8px;
      background: #14122a; border: 1px solid var(--line); border-radius: 8px; }
    #hud-tr.open .minis { display: flex; }
    .minis .mini { font-size: 14px; padding: 11px 10px; text-align: left; }
  }

  /* 물가에 서면 나오는 낚시 버튼 */
  #fishBtn {
    position: absolute; right: 16px; bottom: 16px; z-index: 3;
    font: 700 15px var(--font-body); color: #0d2a2a; background: #9fe0d8;
    border: 0; border-radius: 999px; padding: 13px 20px; cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  }
  #fishBtn[hidden] { display: none; }
  #fishBtn:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
  @media (max-width: 620px) { #fishBtn { right: 8px; bottom: 8px; } }

  /* 어부 가까이에서 나오는 판매 버튼. 낚시 버튼과 같이 나올 때는 그 위에 쌓인다 */
  #sellBtn {
    position: absolute; right: 16px; bottom: 16px; z-index: 3;
    font: 700 15px var(--font-body); color: #20160a; background: var(--gold);
    border: 0; border-radius: 999px; padding: 13px 20px; cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  }
  #sellBtn[hidden] { display: none; }
  #sellBtn.stacked { bottom: 72px; }
  #sellBtn:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
  @media (max-width: 620px) { #sellBtn { right: 8px; bottom: 8px; } #sellBtn.stacked { bottom: 64px; } }

  /* 기록 이어하기 */
  .link-code {
    margin-top: 6px !important; font: 700 20px ui-monospace, "SF Mono", Menlo, Consolas, monospace !important;
    color: var(--gold) !important; letter-spacing: 0.06em; -webkit-user-select: text; user-select: text;
  }
  #linkInput { -webkit-user-select: text; user-select: text; text-transform: uppercase; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
  .link-buttons { display: grid; gap: 6px; }
  #linkMsg { margin: 10px 0; min-height: 20px; font-size: 13px; line-height: 1.5; color: var(--gold); }

  /* 죽은 뒤 나오는 막대: 유언과 공유 */
  #deathBar {
    position: absolute; left: 50%; top: 96px; transform: translateX(-50%); z-index: 4;
    width: min(460px, calc(100% - 16px)); display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    background: rgba(42, 10, 18, 0.94); border: 1px solid #b5322b; border-radius: 10px; padding: 8px 10px;
  }
  #deathBar[hidden] { display: none; }
  #deathText { flex: 1 1 140px; font-size: 14px; color: var(--paper); }
  #deathBar button {
    font: 700 13px var(--font-body); color: #20160a; background: var(--gold);
    border: 0; border-radius: 6px; padding: 8px 10px; cursor: pointer;
  }
  #deathBar button[hidden] { display: none; }
  #deathClose { background: transparent !important; color: var(--paper) !important; border: 1px solid var(--line) !important; font-weight: 500 !important; }
  #willForm { flex: 1 1 100%; display: flex; gap: 6px; }
  #willForm[hidden] { display: none; }
  #willInput {
    flex: 1; min-width: 0; font: 16px var(--font-body); color: var(--paper);
    background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px;
    -webkit-user-select: text; user-select: text;
  }
  #deathBar button:focus-visible, #willInput:focus-visible, #chatMenu button:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
  @media (max-width: 620px) { #deathBar { top: 116px; } }
  /* 채팅 줄을 누르면 나오는 차단·신고 */
  #chatLog p.pick { cursor: pointer; }
  #chatLog p.pick:hover, #chatLog p.pick:focus-visible { background: rgba(255, 255, 255, 0.08); outline: none; }
  #chatMenu {
    position: absolute; left: 16px; bottom: 190px; z-index: 5; display: flex; gap: 6px; align-items: center;
    background: #14122a; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  }
  #chatMenu[hidden] { display: none; }
  #chatMenu b { font-size: 13px; color: var(--gold); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #chatMenu button { font: 500 13px var(--font-body); color: var(--paper); background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; cursor: pointer; }
  #chatReport { border-color: #b5322b !important; color: #ff9a8a !important; }
  @media (max-width: 620px) { #chatMenu { left: 8px; bottom: 150px; } }
  /* 공유 카드 */
  #shareImg { display: block; width: 100%; max-height: 52vh; object-fit: contain; border-radius: 6px; margin-bottom: 10px; background: #0d0b1e; }
  .share-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
  .share-buttons button:not(.mini) { flex: 1; font: 700 14px var(--font-body); color: #20160a; background: var(--gold); border: 0; border-radius: 6px; padding: 11px 12px; cursor: pointer; }
  .share-buttons button:focus-visible, #dailyList button:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
  /* 출석과 목표 */
  .daily-note { margin: 0 0 12px; font-size: 13px; line-height: 1.55; color: #c9c3d6; }
  #dailyList { list-style: none; margin: 0 0 14px; padding: 0; }
  #dailyList li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
  #dailyList li > div { flex: 1; display: grid; gap: 4px; }
  #dailyList b { font-size: 15px; color: var(--paper); }
  #dailyList small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
  #dailyList button { flex: none; min-width: 72px; font: 700 14px var(--font-body); color: #20160a; background: var(--gold); border: 0; border-radius: 6px; padding: 10px 12px; cursor: pointer; }
  #dailyList button:disabled { background: #4a4660; color: #a9a3b8; cursor: default; }
  .legal-links { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
  .legal-links a { color: var(--gold); }
