    :root {
      --bg: #000000;
      --fg: #f8f8f8;
      --dim: #9a9a9a;
      --frame: #f8f8f8;
      --accent: #ffd84a;  /* cursor, player text */
      --link: #6ee7ff;
      --hp: #7cfc7c;
      --danger: #ff6b6b;
      --win-bg: #0a0a2a;
    }
    * { box-sizing: border-box; }
    html, body { height: 100%; margin: 0; }
    body {
      background: var(--bg); color: var(--fg);
      font-family: "DotGothic16", "Hiragino Sans", monospace;
      font-size: 16px; line-height: 1.6; letter-spacing: .03em;
      display: flex; flex-direction: column; gap: 4px;
      padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
      -webkit-font-smoothing: none;
    }
    /* faint CRT scanlines */
    body::after {
      content: ""; position: fixed; inset: 0; pointer-events: none;
      background: repeating-linear-gradient(to bottom, rgba(255,255,255,.035) 0 1px, transparent 1px 3px);
    }
    @media (prefers-reduced-motion: reduce) { .blink, button:hover::before, button:focus-visible::before { animation: none !important; } }

    .win {
      background: var(--win-bg);
      border: 3px solid var(--frame); border-radius: 8px;
      box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--frame);
      padding: 8px 12px; margin: 5px;
      position: relative;
    }
    .win > .title {
      position: absolute; top: -14px; left: 14px; padding: 0 6px;
      background: var(--win-bg); font-size: 14px; line-height: 1.6;
    }

    /* status window */
    #status { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; font-size: 14px; line-height: 1.5; }
    #status > span { white-space: nowrap; }
    #status .k { color: var(--dim); }
    #status .hp { color: var(--hp); }
    #auth { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; grid-row: span 2; align-self: center; }

    /* message log */
    #log { flex: 1; overflow-y: auto; min-height: 0; }
    .msg { margin: 0 0 14px; overflow-wrap: anywhere; }
    .msg .who { display: block; color: var(--dim); font-size: 14px; }
    .msg.user .who, .msg.user .body { color: var(--accent); }
    .msg.system .who { display: inline; color: var(--fg); margin-right: .5em; }
    .msg.system .body { display: inline; }
    .msg.error .body { color: var(--danger); }
    .msg a { color: var(--link); }
    .msg ul { list-style: none; margin: 2px 0; padding-left: 0; }
    .msg li::before { content: "・"; }
    .more { color: var(--accent); }
    .blink { animation: blink 1s steps(1) infinite; }
    @keyframes blink { 50% { opacity: 0; } }

    /* command menu */
    #menu { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; font-size: 15px; }
    button {
      font: inherit; color: inherit; background: none; border: none; padding: 4px 4px 4px 22px;
      text-align: left; position: relative; cursor: pointer; min-height: 36px; white-space: nowrap;
    }
    button::before { content: "▶"; position: absolute; left: 2px; color: var(--accent); visibility: hidden; }
    button:hover::before, button:focus-visible::before { visibility: visible; animation: blink 1s steps(1) infinite; }
    button:focus-visible { outline: 1px dashed var(--accent); }
    button:disabled { color: var(--dim); }
    #auth button { min-height: 32px; font-size: 14px; }

    /* input */
    form { display: flex; gap: 8px; align-items: center; }
    form label { color: var(--accent); white-space: nowrap; }
    input[type=text] {
      flex: 1; min-width: 0; font: inherit; color: var(--fg); background: transparent;
      border: none; border-bottom: 2px solid var(--frame); padding: 4px 2px; caret-color: var(--accent);
    }
    input[type=text]:focus { outline: none; border-bottom-color: var(--accent); }
    .note { color: var(--dim); font-size: 12px; text-align: center; margin: 0; }
    .msg figure.map { margin: 8px 0 0; }
    .msg figure.map img { display: block; width: 100%; max-width: 480px; height: auto; border: 2px solid var(--fg); image-rendering: auto; }
    .msg figure.map figcaption { color: var(--dim); font-size: 13px; margin-top: 2px; }
    [hidden] { display: none !important; }
    /* language switch (top-right of the status window) */
    #lang { position: absolute; top: -9px; right: 10px; display: flex; gap: 4px; background: var(--win-bg); padding: 0 4px; }
    #lang button { font: inherit; font-size: 11px; line-height: 1.25; min-height: 0; min-width: 0; padding: 0 5px; color: var(--dim); background: transparent; border: 1px solid var(--dim); border-radius: 4px; cursor: pointer; }
    #lang button[aria-pressed="true"] { color: var(--fg); border-color: var(--fg); }

    #lang button::before { display: none; }
    /* login window: same frame and menu cursor as the other windows */
    #login-body { white-space: pre-line; font-size: 15px; line-height: 1.7; margin: 4px 0 6px; }
    #login-actions { display: flex; flex-direction: column; align-items: flex-start; }
    #login-actions button { font-size: 15px; }
    #login-actions button:first-child::before { visibility: visible; animation: blink 1s steps(1) infinite; }

