/* RIMVANE — スマホ基準（モバイルファースト）。PC は下の min-width で調整する */

:root {
    --bg: #14161c;
    --panel: #1f2330;
    --panel-2: #262b3b;
    --panel-border: #3a4158;
    --text: #e8e6df;
    --muted: #8f95a8;
    --accent: #f0c94a;
    --danger: #ff8a7a;
    --ok: #9fd48a;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
    -webkit-text-size-adjust: 100%;
}

button {
    font: inherit;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}
button:not(:disabled) { touch-action: manipulation; }
button.is-feedback-pressed:not(:disabled) { filter: brightness(1.2) saturate(1.08); }
button.is-feedback-clicked:not(:disabled) { filter: brightness(1.12) saturate(1.06); }

.game-dialog button,
.sheet button {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.button-feedback-ripple {
    position: absolute;
    z-index: 4;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 238, 179, 0.52);
    box-shadow: 0 0 18px rgba(255, 218, 118, 0.72);
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0);
    animation: button-feedback-ripple 420ms ease-out forwards;
}
button.is-feedback-processing:disabled {
    opacity: 0.9;
    cursor: progress;
    pointer-events: none;
    animation: button-feedback-processing 560ms ease-in-out infinite alternate;
}
button.is-feedback-complete {
    animation: button-feedback-complete 360ms ease-out;
}
button.is-feedback-error {
    animation: button-feedback-error 360ms ease-out;
}
.button-feedback-pop {
    position: fixed;
    z-index: 120;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    color: #ffe19a;
    font-size: 23px;
    font-weight: 800;
    line-height: 24px;
    text-align: center;
    text-shadow: 0 0 10px rgba(255, 210, 98, 0.95);
    pointer-events: none;
    animation: button-feedback-pop 480ms ease-out forwards;
}
.button-feedback-pop.error {
    color: #ff9a88;
    text-shadow: 0 0 10px rgba(255, 94, 78, 0.85);
}

@keyframes button-feedback-ripple {
    0% { opacity: 0.9; transform: translate(-50%, -50%) scale(0); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(12); }
}
@keyframes button-feedback-processing {
    from { box-shadow: 0 0 0 1px rgba(240, 201, 74, 0.25), inset 0 0 0 rgba(255, 224, 139, 0); filter: brightness(1); }
    to { box-shadow: 0 0 0 2px rgba(240, 201, 74, 0.6), 0 0 14px rgba(240, 201, 74, 0.22), inset 0 0 12px rgba(255, 224, 139, 0.12); filter: brightness(1.13); }
}
@keyframes button-feedback-complete {
    0% { box-shadow: 0 0 0 0 rgba(255, 220, 126, 0.8); filter: brightness(1.25); }
    100% { box-shadow: 0 0 0 7px rgba(255, 220, 126, 0); filter: brightness(1); }
}
@keyframes button-feedback-error {
    0% { box-shadow: 0 0 0 0 rgba(255, 104, 88, 0.8); }
    100% { box-shadow: 0 0 0 7px rgba(255, 104, 88, 0); }
}
@keyframes button-feedback-pop {
    0% { opacity: 0; transform: translateY(3px) scale(0.55) rotate(-12deg); }
    35% { opacity: 1; transform: translateY(-5px) scale(1.22) rotate(4deg); }
    100% { opacity: 0; transform: translateY(-19px) scale(0.9) rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
    .button-feedback-ripple,
    .button-feedback-pop { display: none; }
    button.is-feedback-processing:disabled,
    button.is-feedback-complete,
    button.is-feedback-error { animation: none; }
}

/* ---- ゲーム画面（画面いっぱい・スクロールしない） ---- */
.game-page {
    position: fixed;
    inset: 0;
    overflow: hidden;
    overscroll-behavior: none;
}

.update-banner {
    position: fixed;
    z-index: 40;
    top: calc(8px + var(--safe-top));
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: max-content;
    max-width: calc(100vw - 20px - var(--safe-left) - var(--safe-right));
    min-height: 40px;
    padding: 7px 10px 7px 14px;
    color: #fff7d8;
    background: rgba(30, 28, 19, 0.96);
    border: 1px solid rgba(240, 201, 74, 0.8);
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.45);
    transform: translateX(-50%);
    font-size: 13px;
    font-weight: bold;
}
.update-banner[hidden] { display: none; }
.update-banner a,
.update-banner button {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    color: #201b09;
    background: var(--accent);
    border-radius: 14px;
    text-decoration: none;
    touch-action: manipulation;
}
.update-banner a:focus-visible,
.update-banner button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.release-notice { width: 420px; border-radius: 12px; line-height: 1.6; }
.release-notice span { min-width: 0; }
.release-notice button { flex-shrink: 0; min-height: 40px; border: 0; font: inherit; cursor: pointer; }

.stage {
    position: absolute;
    inset: 0;
    touch-action: none;           /* ドラッグでスクロール・拡大しない */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    background: #000;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;            /* 縦横比の上限に当たった時は伸ばさず余白にする */
    image-rendering: pixelated;
}

/* フローティングスティック */
.joystick {
    position: absolute;
    width: 120px;
    height: 120px;
    margin: -60px 0 0 -60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.35);
    pointer-events: none;
}
.joystick[hidden] { display: none; }
.joystick-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    border: 2px solid rgba(255, 255, 255, 0.8);
    transform: translate(-50%, -50%);
}

.stick-hint {
    position: absolute;
    left: 50%;
    bottom: calc(150px + var(--safe-bottom));
    transform: translateX(-50%);
    margin: 0;
    padding: 8px 14px;
    border-radius: 18px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 14px;
    text-align: center;
    pointer-events: none;
    animation: hint-pulse 2s ease-in-out infinite;
}
.stick-hint small { color: var(--muted); font-size: 11px; }
@keyframes hint-pulse { 50% { opacity: 0.55; } }

/* 近くの施設・痕跡の説明。通常は1行に畳み、読みたい時だけ上へ展開する */
.context-info {
    --context-color: #ffe98a;
    position: absolute;
    z-index: 4;
    left: calc(10px + var(--safe-left));
    right: calc(72px + var(--safe-right));
    bottom: calc(96px + var(--safe-bottom));
    display: grid;
    gap: 3px;
    max-width: 380px;
    min-height: 52px;
    padding: 8px 10px;
    overflow: hidden;
    color: var(--text);
    text-align: left;
    background: rgba(12, 12, 20, 0.78);
    border: 1px solid var(--context-color);
    border-left: 4px solid var(--context-color);
    border-radius: 8px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(4px);
    cursor: pointer;
    touch-action: manipulation;
}
.context-info[hidden] { display: none; }
.context-info-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.context-info-head strong {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--context-color);
    font-size: 13px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.context-info-toggle { flex: 0 0 auto; color: #bec3d0; font-size: 10px; }
.context-info-description {
    display: block;
    overflow: hidden;
    color: #e8e6df;
    font-size: 12px;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.context-info-prompt { color: #ffe98a; font-size: 11px; font-weight: bold; line-height: 1.4; }
.context-info[aria-expanded="true"] {
    max-height: min(42dvh, 240px);
    overflow-y: auto;
    background: rgba(12, 12, 20, 0.94);
}
.context-info[aria-expanded="true"] .context-info-description { overflow: visible; white-space: normal; }
.context-info:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

@media (pointer: coarse) {
    .context-info-prompt { display: none; }
}

@media (min-width: 700px) {
    .context-info { right: auto; bottom: calc(16px + var(--safe-bottom)); width: 360px; }
}

/* 右下の操作ボタン */
.controls {
    position: absolute;
    right: calc(10px + var(--safe-right));
    bottom: calc(14px + var(--safe-bottom));
    display: flex;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
}
.controls > * { pointer-events: auto; }

.btn-stack { display: flex; flex-direction: column; gap: 8px; }

.btn-round {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    background: rgba(20, 22, 30, 0.72);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    cursor: pointer;
    touch-action: manipulation;
}
.btn-round:active { background: rgba(240, 201, 74, 0.35); }
.btn-round[hidden] { display: none; }

.menu-icon, .menu-icon::before, .menu-icon::after {
    display: block;
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}
.menu-icon { position: relative; margin-bottom: 4px; }
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
.menu-icon::before { top: -5px; }
.menu-icon::after { top: 5px; }

/* その場でできる行動（祈る・役に立った） */
.btn-action {
    min-width: 96px;
    height: 72px;
    padding: 0 16px;
    border-radius: 36px;
    border: 3px solid var(--accent);
    background: rgba(58, 48, 16, 0.88);
    color: #fff4d0;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 16px rgba(240, 201, 74, 0.45);
    animation: action-in 0.18s ease-out;
    touch-action: manipulation;
}
.btn-action[hidden] { display: none; }
.btn-action:active { transform: scale(0.96); }
@keyframes action-in { from { transform: scale(0.7); opacity: 0; } }

/* ---- メニュー（画面中央の旅人の手帳） ---- */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10;
}
.sheet-backdrop[hidden] { display: none; }

.sheet {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 11;
    width: min(680px, calc(100vw - 24px));
    max-height: min(86dvh, 760px);
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -50%) scale(0.97);
    transition: opacity 0.14s ease-out, transform 0.14s ease-out, visibility 0s linear 0.14s;
}
.sheet.open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
    transition-delay: 0s;
}

.sheet-header {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 16px 6px;
}
.logo-small { color: var(--accent); letter-spacing: 2px; font-weight: bold; font-size: 13px; }
.sheet-player { font-size: 14px; color: var(--muted); margin-top: 2px; }
.sheet-player strong { color: var(--text); }
.save-status { font-size: 11px; margin-left: 6px; }
.save-status.error { color: var(--danger); }
.sheet-close {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--panel-2);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.tabs {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 0 12px;
    border-bottom: 1px solid var(--panel-border);
}
.tabs button {
    min-height: 44px;
    border: none;
    border-bottom: 3px solid transparent;
    background: none;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); font-weight: bold; }

.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 16px 20px; -webkit-overflow-scrolling: touch; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.panel-lead { margin: 0 0 10px; font-size: 13px; color: var(--muted); }

.info-list { margin: 0; display: grid; gap: 10px; }
.info-list div { display: grid; grid-template-columns: 4.5em 1fr; gap: 8px; }
.info-list dt { color: var(--muted); font-size: 14px; }
.info-list dd { margin: 0; font-size: 15px; line-height: 1.5; }
.stars { color: var(--accent); }
.info-debug dd, .info-debug dt { font-size: 12px; color: var(--muted); }

.gold-line { margin: 0 0 10px; color: var(--muted); }
.gold { font-size: 22px; color: var(--accent); margin-left: 8px; }

.materials { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.materials li { font-size: 15px; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.materials .empty { color: var(--muted); }
.mat-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 8px;
    transform: rotate(45deg);
    border: 1px solid rgba(0, 0, 0, 0.5);
}
.mat-run { margin-left: 4px; font-size: 12px; color: var(--ok); }

.weapons { display: grid; gap: 8px; }
.weapons button {
    min-height: 52px;
    text-align: left;
    font-size: 15px;
    background: var(--panel-2);
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
}
.weapons button:disabled { color: var(--muted); cursor: default; opacity: 0.6; }
.weapons button.equipped { border-color: var(--accent); background: #3a3520; }
.weapons button.legendary:not(:disabled) { color: #ffd86a; }
.bs-reforge .bs-name { color: #9fd4ff; }

.menu-buttons { display: grid; gap: 8px; margin-bottom: 16px; }
.menu-button {
    width: 100%;
    min-height: 48px;
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    background: var(--panel-2);
    font-size: 15px;
    cursor: pointer;
}
.menu-button.subtle { color: var(--muted); }
#auto-tool-delay,
#camera-follow-distance { color: var(--text); font-size: 16px; padding: 6px 10px; }
.help-title { font-size: 14px; color: var(--muted); margin: 0 0 6px; }
.help-guides { display: grid; gap: 7px; margin: 0 0 18px; }
.help-guides details {
    overflow: hidden;
    border: 1px solid rgba(149, 165, 160, 0.18);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.025);
}
.help-guides summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 8px 36px 8px 10px;
    position: relative;
    cursor: pointer;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
}
.help-guides summary::-webkit-details-marker { display: none; }
.help-guides summary::after {
    content: '＋';
    position: absolute;
    right: 12px;
    color: #a9b4b1;
    font-size: 18px;
}
.help-guides details[open] summary::after { content: '−'; color: var(--accent); }
.help-guide-icon {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(217, 181, 104, 0.42);
    border-radius: 50%;
    color: var(--accent);
    background: rgba(217, 181, 104, 0.07);
    font-family: Georgia, "Yu Mincho", serif;
    font-size: 13px;
}
.help-guides summary span:last-child { display: grid; gap: 2px; min-width: 0; }
.help-guides summary strong { color: var(--text); font-size: 14px; font-weight: 650; }
.help-guides summary small { color: var(--muted); font-size: 11px; }
.help-guides details[open] summary { border-bottom: 1px solid rgba(149, 165, 160, 0.12); }
.help-guides ul { margin: 0; padding: 10px 14px 12px 30px; color: #c7cfcc; font-size: 12px; line-height: 1.65; }
.help-guides li + li { margin-top: 5px; }
.logout-form { margin: 0; }

/* ---- ダイアログ（全画面サイズで中央表示） ---- */
.game-dialog {
    width: min(620px, calc(100vw - 24px));
    max-width: 620px;
    max-height: 86dvh;
    margin: auto;
    padding: 16px;
    overflow-y: auto;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
}
.game-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.game-dialog h2 { margin: 0 0 4px; color: var(--accent); font-size: 18px; }
.dialog-lead { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.dialog-message { min-height: 1.4em; font-size: 14px; color: var(--ok); }
.dialog-message.error { color: var(--danger); }
.dialog-close {
    width: 100%;
    min-height: 48px;
    background: var(--panel-2);
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
}
.game-dialog form[method="dialog"] { margin: 0; }
.dialog-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.primary-button {
    min-height: 48px;
    font-weight: bold;
    color: #1a1500;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
}

/* 鍛冶屋 */
.blacksmith-list { display: grid; gap: 8px; }
.bs-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
    align-items: center;
    padding: 10px 12px;
    background: var(--panel-2);
    border-radius: 8px;
    font-size: 14px;
}
.bs-name { font-weight: bold; }
.bs-cost { grid-column: 1; font-size: 12px; color: var(--muted); line-height: 1.6; }
.bs-cost .short { color: var(--danger); }
.bs-row button {
    grid-row: 1 / span 2;
    grid-column: 2;
    min-height: 48px;
    background: #4a3a18;
    border: 2px solid var(--accent);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
}
.bs-row button:disabled { opacity: 0.4; cursor: default; }

/* 世界新聞 */
.news-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.news-list li {
    padding: 10px 12px;
    background: var(--panel-2);
    border-left: 4px solid var(--panel-border);
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
}
.news-list li.player_death { border-left-color: #c05050; }
.news-list li.chest_found { border-left-color: #b080e0; }
.news-list li.region_discovered { border-left-color: #60a0e0; }
.news-list li.named_spawn,
.news-list li.named_defeated,
.news-list li.landmark_first,
.news-list li.region_completed { border-left-color: var(--accent); }
.news-list li.region_event { border-left-color: #e09040; }
.news-list li.named_escape { border-left-color: #d06030; }
.news-list .news-time { display: block; font-size: 12px; color: var(--muted); }
.news-list .empty { border-left-color: transparent; color: var(--muted); }

/* 伝言 */
.message-form { display: grid; gap: 10px; }
.message-selects { display: grid; gap: 8px; }
.message-selects select {
    min-height: 48px;
    font-size: 16px;               /* iOS で入力時に拡大されない大きさ */
    color: var(--text);
    background: #14161c;
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    padding: 6px 10px;
}
.message-preview { margin: 0; font-size: 20px; color: #ffcf7a; text-align: center; }

/* 世界地図 */
.worldmap { margin-bottom: 12px; }
.worldmap svg { display: block; margin: 0 auto; width: 100%; height: auto; max-height: 60dvh; }
.worldmap .link { stroke: #6a7390; stroke-width: 3; stroke-dasharray: 6 5; }
.worldmap .link.visited { stroke: #c8b88a; stroke-dasharray: none; }
.worldmap .node rect { fill: #262b3b; stroke: #3a4158; stroke-width: 2; }
.worldmap .node.visited rect { fill: #2e3448; stroke: #8a8fa8; }
.worldmap .node.current rect { stroke: var(--accent); stroke-width: 3; }
.worldmap .node.completed rect { fill: #3a3520; }
.worldmap .node.unknown rect { fill: #181b24; stroke-dasharray: 4 3; }
.worldmap text { fill: var(--text); font-size: 13px; }
.worldmap .name { font-weight: bold; font-size: 14px; }
.worldmap .unknown .name { fill: #6a7390; letter-spacing: 3px; }
.worldmap .sub { fill: var(--muted); font-size: 11px; }
.worldmap .stars { fill: var(--accent); font-size: 11px; }
.worldmap .danger { fill: var(--danger); font-size: 11px; }
.worldmap .here { fill: var(--accent); font-size: 11px; font-weight: bold; }
.worldmap .hint { fill: #c8b8ff; font-size: 11px; }

/* タッチ操作の端末では PC 向けの説明を隠す */
@media (hover: none) and (pointer: coarse) {
    .pc-only { display: none; }
}

/* ---- タブレット・PC ---- */
@media (min-width: 720px) {
    .sheet {
        width: min(680px, calc(100vw - 32px));
        max-height: calc(100dvh - 32px);
        border: 3px solid var(--panel-border);
        border-radius: 12px;
    }
    .game-dialog {
        width: min(560px, calc(100vw - 32px));
        margin: auto;
        border: 3px solid var(--panel-border);
        border-radius: 12px;
        padding-bottom: 16px;
    }
    .message-selects { grid-template-columns: 1fr 1fr; }
}

/* ---- ログイン / 登録 ---- */
.auth-page {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 16px;
}
.auth-card {
    width: min(400px, 100%);
    background: var(--panel);
    border: 3px solid var(--panel-border);
    border-radius: 12px;
    padding: 24px;
}
.logo { margin: 0; text-align: center; letter-spacing: 6px; color: var(--accent); }
.tagline { text-align: center; color: var(--muted); font-size: 13px; margin: 4px 0 20px; }
.auth-notice {
    display: grid;
    gap: 3px;
    margin: 0 0 16px;
    padding: 10px 12px;
    color: var(--muted);
    background: #292718;
    border: 1px solid rgba(240, 201, 74, 0.35);
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.6;
}
.auth-notice strong { color: var(--accent); font-size: 13px; }
.auth-form { display: grid; gap: 12px; }
.auth-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.auth-form label.checkbox { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.settings-name-form, .avatar-change-form { display: grid; gap: 10px; }
.settings-name-form label { font-size: 13px; color: var(--muted); }
.settings-name-form input {
    min-width: 0;
    min-height: 48px;
    padding: 8px 10px;
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    background: #14161c;
    color: var(--text);
    font: inherit;
    font-size: 16px;
}
.settings-name-form .panel-lead { margin: 0; }
.avatar-change-form .panel-lead { margin: 0; }
.auth-form input[type=text],
.auth-form input[type=email],
.auth-form input[type=password] {
    font: inherit;
    font-size: 16px;               /* iOS で入力時に拡大されない大きさ */
    min-height: 48px;
    color: var(--text);
    background: #14161c;
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    padding: 8px 10px;
}
.auth-form button {
    margin-top: 4px;
    min-height: 52px;
    font-weight: bold;
    font-size: 16px;
    color: #1a1500;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.auth-switch { text-align: center; font-size: 14px; color: var(--muted); }
.auth-switch a { color: var(--accent); display: inline-block; padding: 8px; }
.form-errors {
    margin: 0 0 12px;
    padding: 8px 12px 8px 28px;
    background: #3a1a1a;
    border-radius: 8px;
    color: #ffb4a8;
    font-size: 13px;
}
.form-status {
    margin: 0 0 16px;
    padding: 11px 13px;
    border: 1px solid rgba(138, 255, 154, .25);
    border-radius: 10px;
    background: rgba(138, 255, 154, .08);
    color: #c9ffd1;
    font-size: 13px;
    line-height: 1.6;
}

/* 世界地図（キャンバス） */
.worldmap-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.worldmap-tabs button {
    min-height: 40px;
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    background: var(--panel-2);
    cursor: pointer;
}
.worldmap-tabs button.active { border-color: var(--accent); color: var(--accent); font-weight: bold; }
.worldmap-canvas {
    display: block;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    aspect-ratio: 1;
    image-rendering: pixelated;
    border: 2px solid var(--panel-border);
    border-radius: 6px;
}
.worldmap-info { margin-top: 8px; font-size: 13px; line-height: 1.6; }
.worldmap-info p { margin: 0; }
.worldmap-presence-status { color: #bfe9ff; }
.worldmap-own-camp { color: #ffcf8a; }
.worldmap-legend { color: var(--muted); font-size: 11px; }
.worldmap-clues { margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.08); }
.worldmap-clues h3 { margin: 0 0 4px; font-size: 12px; color: #a8b4ff; letter-spacing: 0.05em; }
.worldmap-clues p { margin: 0 0 6px; font-size: 12px; line-height: 1.5; }
.worldmap-clues strong { color: #c8d0ff; font-weight: 600; }
.worldmap-clues .coords { margin-left: 6px; color: var(--muted); font-size: 11px; }
.worldmap-clues p.center strong { color: #ffd24a; }

/* ---- 店・道具 ---- */
.panel-sub { margin: 12px 0 6px; font-size: 13px; color: #c8c0a8; }
/* 一覧ごとのスクロールを作らず、ダイアログや手帳の本文でまとめてスクロールする。 */
.shop-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.shop-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: rgba(255,255,255,0.05); border-radius: 8px; font-size: 14px; }
.shop-list .shop-name { flex: 1; }
.shop-list .shop-price { color: #ffd23f; min-width: 48px; text-align: right; }
.shop-list button, .consumables button { min-height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid #6a6450; background: #2e2a22; color: #f0e8d0; font-size: 13px; }
.shop-list button:disabled { opacity: 0.4; }
.shop-dialog[open] {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    overflow: hidden;
}
/* スマホ用の飾り線をグリッドの行として数えない。 */
.shop-dialog[open]::before {
    position: absolute;
    top: 7px;
    left: 50%;
    margin: 0;
    transform: translateX(-50%);
}
@media (max-width: 699px) {
    .shop-dialog[open] { max-height: min(78dvh, 620px); }
}
.shop-dialog-head { min-width: 0; }
.shop-dialog-head .dialog-lead:last-child { margin-bottom: 6px; }
.shop-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: 4px 0 10px;
    padding: 4px;
    border: 1px solid rgba(217, 181, 104, 0.18);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
}
.shop-tabs button {
    min-height: 44px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #aab3b1;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.shop-tabs button.active {
    border-color: rgba(217, 181, 104, 0.48);
    background: linear-gradient(180deg, rgba(217, 181, 104, 0.22), rgba(217, 181, 104, 0.1));
    color: #f5d98f;
    box-shadow: inset 0 1px rgba(255, 244, 211, 0.08);
}
.shop-panel { min-height: 0; overflow: hidden; }
.shop-panel[hidden] { display: none; }
.shop-panel:not([hidden]) { display: grid; }
.shop-dialog .shop-list {
    max-height: none;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
}
.shop-panel[data-shop-panel="buy"]:not([hidden]) {
    display: block;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
}
.shop-panel[data-shop-panel="buy"] .shop-list {
    overflow: visible;
    padding-right: 0;
}
.shop-trade-panel:not([hidden]) { grid-template-rows: auto minmax(0, 1fr); }
.shop-trade-panel .dialog-lead { margin: 0 2px 8px; }
.shop-dialog .dialog-message { margin: 8px 0 6px; }
.consumables li { display: flex; align-items: center; gap: 8px; }
.consumables li span.grow { flex: 1; }
.btn-potion { position: relative; background: #3a5a3a; }
.btn-count { position: absolute; right: -4px; top: -4px; min-width: 18px; padding: 0 4px; border-radius: 9px; background: #d84a3a; color: #fff; font-size: 11px; line-height: 18px; }

/* ---- 称号・実績 ---- */
.player-title { color: #ffe9b0; margin-left: 2px; }
.achievements li.locked { opacity: 0.55; }
.achievements .ach-desc { display: block; font-size: 12px; color: #b8b0a0; }
.achievements .ach-count { color: #9fe8ff; min-width: 64px; text-align: right; font-size: 12px; }
.achievements button.wearing { border-color: #ffd24a; color: #ffd24a; }

/* 世界地図への書き込み */
.worldmap-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
.worldmap-tools button { font: inherit; font-size: 12px; padding: 5px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.05); color: var(--text, #e8e6df); cursor: pointer; }
.worldmap-tools button.active { border-color: #e6c17b; background: rgba(230,193,123,0.16); color: #ffe3a6; }
.worldmap-tools button.atlas-travel { flex: 1 0 100%; min-height: 44px; border-color: #cbaa70; background: #594631; color: #fff0ca; font-size: 14px; font-weight: bold; }
.worldmap-tools .note-icons { display: flex; gap: 4px; }
.worldmap-tools .note-icons button { width: 32px; height: 32px; padding: 0; font-size: 16px; font-weight: bold; }
.worldmap-tools input { flex: 1 1 140px; min-width: 0; font: inherit; font-size: 13px; padding: 6px 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.14); background: rgba(0,0,0,0.3); color: inherit; }
.worldmap-tools .hint { flex-basis: 100%; margin: 0; font-size: 11px; color: var(--muted); }
.worldmap-tools .note-detail { display: flex; align-items: center; gap: 8px; flex: 1; padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,0.05); }
.worldmap-tools .note-detail .glyph { font-weight: bold; font-size: 16px; }
.worldmap-tools .note-detail .text { flex: 1; font-size: 13px; overflow-wrap: anywhere; }
.worldmap-tools button.danger { border-color: rgba(255,120,110,0.4); color: #ffb0a8; }
.worldmap-tools .map-note-manager { flex: 1 0 100%; display: grid; gap: 5px; padding: 8px; border: 1px solid rgba(255,255,255,0.1); border-radius: 9px; background: rgba(0,0,0,0.2); }
.worldmap-tools .map-note-manager .manager-title { margin: 0 2px 2px; color: var(--muted); font-size: 11px; }
.worldmap-tools .map-note-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 7px; min-height: 42px; padding: 5px 6px; border-radius: 7px; background: rgba(255,255,255,0.05); }
.worldmap-tools .map-note-row .glyph { text-align: center; font-size: 17px; font-weight: bold; }
.worldmap-tools .map-note-row .text { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.worldmap-tools .map-note-row button { min-height: 34px; padding-inline: 12px; }
.worldmap-canvas.pen { cursor: crosshair; }
.worldmap-canvas.atlas-canvas { touch-action: none; cursor: grab; image-rendering: auto; border-color: #647561; background: #172725; }
.worldmap-canvas.atlas-canvas:active { cursor: grabbing; }
.worldmap-canvas.atlas-canvas.pen { cursor: crosshair; }
.atlas-controls { display: flex; align-items: center; gap: 8px; width: 100%; }
.worldmap-tools .atlas-controls button { min-width: 44px; min-height: 44px; font-size: 16px; border-color: #778464; color: #ecdfb8; }
.worldmap-tools .atlas-controls button:last-child { margin-left: auto; font-size: 13px; }
.worldmap-tools button:disabled { opacity: 0.4; cursor: default; }
.atlas-scale { min-width: 44px; text-align: center; color: #c6c8ac; font-size: 12px; }
.worldmap-tools .atlas-hint { margin: 0; }
.atlas-selection { display: flex; flex-direction: column; gap: 4px; min-height: 60px; margin-bottom: 10px; padding: 10px 12px; border: 1px solid #647561; border-radius: 8px; background: #23362e; overflow-wrap: anywhere; }
.atlas-selection strong { color: #e4ce98; font-family: serif; font-size: 16px; }
.atlas-selection span { color: #b8c2b1; font-size: 12px; }
.worldmap-clues.treasure h3 { color: #ffd88a; }
.worldmap-clues.treasure strong { color: #ffd88a; }

/* 焚火で料理 */
.cook-list li { align-items: flex-start; }
.cook-body { flex: 1; display: grid; gap: 3px; }
.cook-name { font-weight: 600; color: #ffe3a6; }
.cook-active { margin-left: 8px; font-size: 11px; font-weight: normal; color: #8ee0a0; }
.cook-effect { font-size: 12px; color: #d8d2c0; }
.cook-hunger { font-size: 12px; color: #e8b872; }
.cook-ings { display: flex; flex-wrap: wrap; gap: 4px; }
.cook-ings .ing { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,0.06); }
.cook-ings .ing.ok { color: #9fe0a8; }
.cook-ings .ing.short { color: #ff9a8a; }
.cook-list li button { align-self: center; }

/* 星座図鑑 */
.worldmap-clues.stars h3 { color: #c8d4ff; }
.worldmap-clues .star-hint { font-size: 11px; color: var(--muted); }
.star-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 4px; }
.star-grid span { font-size: 12px; padding: 3px 6px; border-radius: 6px; background: rgba(255,255,255,0.04); color: #6a6f80; text-align: center; }
.star-grid span.found { color: #e8ecff; background: rgba(160,180,255,0.14); }
.consumables li.tool .grow { color: #d8d2c0; }

/* 道具の耐久 */
.durability { width: 56px; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.1); overflow: hidden; flex: none; }
.durability > span { display: block; height: 100%; background: #7fd08a; }
.durability.low > span { background: #ffb45a; }
.durability.broken { outline: 1px solid rgba(255,110,100,0.6); }
/* 魚の図鑑 */
.fish-book li { display: grid; gap: 2px; }
.fish-book li.unknown { opacity: 0.6; }
.fish-head { display: flex; justify-content: space-between; gap: 8px; }
.fish-name { font-weight: 600; color: #cfe8ff; }
.fish-when { font-size: 11px; color: var(--muted); }
.fish-rec { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: 12px; color: #d8d2c0; }
.fish-world { color: #ffd24a; }

/* 野営地 */
.camp-actions { display: grid; gap: 8px; }
.camp-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,0.05); }
.camp-text { flex: 1; display: grid; gap: 4px; font-size: 13px; }
.camp-row button { min-height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid #6a6450; background: #2e2a22; color: #f0e8d0; font-size: 13px; }
.camp-row button:disabled { opacity: 0.4; }
#build-camp-note { display: grid; gap: 5px; margin: 4px 0 0; font-size: 12px; }
#build-camp-note .cook-ings { margin-top: 4px; }
#build-camp-note .camp-remote-note { color: var(--muted); }
#build-camp-note .camp-remote-dismantle {
    min-height: 42px;
    margin-top: 3px;
    border-color: rgba(255, 138, 122, 0.48);
    color: #ffb0a8;
}

/* 開拓地：共同の蔵・掲示板 */
.colony-tabs { margin-bottom: 8px; }
.facilities li { display: grid; gap: 4px; }
.facilities li.built { background: rgba(120,200,140,0.12); }
.fac-head { display: flex; justify-content: space-between; }
.fac-head strong { color: #ffe3a6; }
.fac-head span { font-size: 11px; color: var(--muted); }
.fac-text { font-size: 12px; color: #d8d2c0; }
.fac-mat { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.fac-mat > span:first-child { min-width: 96px; }
.fac-bar { flex: 1; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.1); overflow: hidden; }
.fac-bar > span { display: block; height: 100%; background: #e6c17b; }
.fac-mat button { min-height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid #6a6450; background: #2e2a22; color: #f0e8d0; font-size: 12px; }
.fac-mat button:disabled { opacity: 0.4; }
.contributors { font-size: 12px; color: #d8d2c0; }
.raid-note { margin: 0 0 6px; padding: 6px 10px; border-radius: 8px; background: rgba(200,70,60,0.18); color: #ffb0a0; font-size: 12px; }
.req-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.req-form select, .req-form input { font: inherit; font-size: 13px; padding: 5px 6px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.15); background: rgba(0,0,0,0.3); color: inherit; }
.req-form input { width: 64px; }
.req-form button { min-height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid #6a6450; background: #2e2a22; color: #f0e8d0; }

/* ---- 建てる物のスロット（画面左下） ---- */
.hotbar {
    position: absolute;
    left: calc(10px + var(--safe-left, 0px));
    bottom: calc(14px + var(--safe-bottom));
    display: flex;
    gap: 6px;
    padding: 5px;
    border-radius: 14px;
    background: rgba(12, 14, 20, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 3;
}
.hotbar .slot {
    position: relative;
    width: 54px;
    height: 54px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.18);
    background: rgba(30, 32, 42, 0.85);
    color: #efe8d6;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    padding: 0;
    cursor: pointer;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}
.hotbar .slot.active { border-color: #f0c94a; background: rgba(90, 72, 20, 0.9); box-shadow: 0 0 0 2px rgba(240, 201, 74, 0.25); }
.hotbar .slot.empty { opacity: 0.5; }
.hotbar .slot-name { font-size: 9px; line-height: 1; white-space: nowrap; }
.hotbar .slot-count {
    position: absolute;
    right: 3px;
    top: 2px;
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px #000;
}
.slot-icon { display: block; width: 22px; height: 22px; border-radius: 4px; }
.slot-road { background:
    linear-gradient(90deg, transparent 45%, rgba(0,0,0,0.25) 45% 55%, transparent 55%),
    linear-gradient(transparent 45%, rgba(0,0,0,0.25) 45% 55%, transparent 55%),
    #a8a397; }
.slot-bridge { background:
    linear-gradient(#735032, #735032) 0 3px / 100% 3px no-repeat,
    linear-gradient(#735032, #735032) 0 16px / 100% 3px no-repeat,
    repeating-linear-gradient(90deg, #b89464 0 5px, #735032 5px 6px) 0 3px / 100% 16px no-repeat; border-radius: 0; }
.slot-signpost { background:
    linear-gradient(90deg, transparent 44%, #6a4a2a 44% 56%, transparent 56%) 0 0 / 100% 100% no-repeat,
    linear-gradient(#b89464, #b89464) 2px 3px / 18px 8px no-repeat; border-radius: 0; }
.slot-walk { background:
    radial-gradient(ellipse 4px 6px at 8px 14px, #d8c8a8 90%, transparent 100%),
    radial-gradient(ellipse 4px 6px at 15px 7px, #d8c8a8 90%, transparent 100%); }
.hotbar-hint {
    position: absolute;
    left: calc(10px + var(--safe-left, 0px));
    bottom: calc(84px + var(--safe-bottom));
    margin: 0;
    padding: 5px 10px;
    border-radius: 8px;
    background: rgba(12, 14, 20, 0.78);
    color: #efe8d6;
    font-size: 12px;
    pointer-events: none;
    z-index: 3;
}
.hotbar-hint[hidden] { display: none; }
/* ドラッグ中に指の下についてくる、置く物の絵 */
.slot-drag {
    position: fixed;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border-radius: 8px;
    pointer-events: none;
    opacity: 0.85;
    z-index: 50;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

/* パレット：持っている物だけ並び、たためる */
.hotbar[hidden] { display: none; }
.hotbar { align-items: center; }
.hotbar-slots { display: flex; gap: 6px; }
.hotbar.folded .hotbar-slots { display: none; }
.hotbar-fold {
    width: 22px;
    height: 54px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #cfc8b8;
    font-size: 16px;
    padding: 0;
    cursor: pointer;
}
.hotbar.folded .hotbar-fold { width: 34px; height: 34px; }
.slot-torch { background:
    linear-gradient(90deg, transparent 42%, #7a5434 42% 58%, transparent 58%) 0 8px / 100% 14px no-repeat,
    radial-gradient(circle at 11px 7px, #ffd27a 3px, #ff8a3a 6px, transparent 7px); }
.slot-tent { background:
    linear-gradient(135deg, transparent 50%, #9a7848 50%) 11px 4px / 11px 16px no-repeat,
    linear-gradient(225deg, transparent 50%, #b8945e 50%) 0 4px / 11px 16px no-repeat;
    border-radius: 0; }

/* 開拓地の名付けと旗 */
.flag-chip { display: inline-grid; place-items: center; width: 26px; height: 20px; border-radius: 3px; font-size: 13px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.6); margin-right: 6px; vertical-align: middle; }
.naming-form { display: grid; gap: 8px; }
.naming-form input { font: inherit; font-size: 14px; padding: 6px 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.15); background: rgba(0,0,0,0.3); color: inherit; }
.swatches, .emblems { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.2); cursor: pointer; }
.emblems button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.05); color: #fff; font-size: 17px; cursor: pointer; }
.swatches button.active, .emblems button.active { border-color: #f0c94a; box-shadow: 0 0 0 2px rgba(240,201,74,0.35); }
.naming-form .submit { min-height: 38px; border-radius: 8px; border: 1px solid #6a6450; background: #2e2a22; color: #f0e8d0; font-size: 14px; }

/* ---- RIMVANE interface -------------------------------------------------
   黒鉄、古地図、琥珀を基調に、探索画面の視界を残す薄いレイヤーで統一する。 */
:root {
    --bg: #080d0f;
    --panel: #11191c;
    --panel-2: #182226;
    --panel-border: #38474a;
    --text: #f1eee5;
    --muted: #9ca6a5;
    --accent: #d9b568;
    --accent-bright: #f1cf7c;
    --rim-teal: #6fb7ad;
    --danger: #e87f70;
    --ok: #87c99a;
}

.game-page {
    background:
        radial-gradient(circle at 50% 35%, #172326 0, #080d0f 72%);
}

.stage::before,
.stage::after {
    position: absolute;
    inset: 0;
    z-index: 2;
    content: "";
    pointer-events: none;
}
.stage::before {
    background:
        linear-gradient(180deg, rgba(4, 9, 11, 0.38), transparent 13%, transparent 78%, rgba(4, 9, 11, 0.42)),
        linear-gradient(90deg, rgba(4, 9, 11, 0.2), transparent 9%, transparent 91%, rgba(4, 9, 11, 0.2));
    box-shadow: inset 0 0 0 1px rgba(204, 175, 111, 0.14);
}
.stage::after {
    inset: 6px;
    border: 1px solid rgba(217, 181, 104, 0.1);
    clip-path: polygon(0 0, 24px 0, 24px 1px, calc(100% - 24px) 1px, calc(100% - 24px) 0, 100% 0, 100% 24px, calc(100% - 1px) 24px, calc(100% - 1px) calc(100% - 24px), 100% calc(100% - 24px), 100% 100%, calc(100% - 24px) 100%, calc(100% - 24px) calc(100% - 1px), 24px calc(100% - 1px), 24px 100%, 0 100%, 0 calc(100% - 24px), 1px calc(100% - 24px), 1px 24px, 0 24px);
}

.joystick,
.stick-hint,
.hotbar,
.hotbar-hint,
.context-info,
.controls { z-index: 5; }

.joystick {
    background: radial-gradient(circle, rgba(111, 183, 173, 0.12), rgba(7, 13, 15, 0.32));
    border: 1px solid rgba(222, 205, 163, 0.48);
    box-shadow: inset 0 0 18px rgba(111, 183, 173, 0.18), 0 4px 18px rgba(0, 0, 0, 0.3);
}
.joystick-knob {
    background: rgba(217, 181, 104, 0.32);
    border: 1px solid rgba(255, 238, 195, 0.78);
    box-shadow: 0 0 16px rgba(217, 181, 104, 0.22);
}

.stick-hint {
    border: 1px solid rgba(217, 181, 104, 0.28);
    background: rgba(8, 14, 16, 0.78);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
}

.context-info {
    left: calc(12px + var(--safe-left));
    right: calc(76px + var(--safe-right));
    bottom: calc(98px + var(--safe-bottom));
    grid-template-columns: 1fr;
    gap: 2px;
    max-width: 390px;
    min-height: 58px;
    padding: 9px 12px 9px 46px;
    border: 1px solid color-mix(in srgb, var(--context-color) 46%, #536266);
    border-left: 1px solid color-mix(in srgb, var(--context-color) 46%, #536266);
    border-radius: 12px;
    background:
        linear-gradient(110deg, rgba(22, 32, 32, 0.96), rgba(8, 15, 17, 0.9)),
        rgba(8, 15, 17, 0.92);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34), inset 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px) saturate(115%);
}
.context-info::before {
    position: absolute;
    left: 13px;
    top: 50%;
    width: 20px;
    height: 20px;
    border: 1px solid var(--context-color);
    border-radius: 50%;
    background:
        radial-gradient(circle, var(--context-color) 0 2px, transparent 3px),
        linear-gradient(45deg, transparent 46%, var(--context-color) 47% 53%, transparent 54%),
        linear-gradient(-45deg, transparent 46%, var(--context-color) 47% 53%, transparent 54%);
    content: "";
    opacity: 0.9;
    transform: translateY(-50%) rotate(45deg);
    box-shadow: 0 0 12px color-mix(in srgb, var(--context-color) 30%, transparent);
}
.context-info::after {
    position: absolute;
    left: 46px;
    right: 12px;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--context-color), transparent 74%);
    content: "";
    opacity: 0.7;
}
.context-info-head strong {
    color: var(--context-color);
    font-size: 12px;
    letter-spacing: 0.08em;
}
.context-info-toggle {
    color: #bbc3bf;
    font-size: 9px;
    letter-spacing: 0.08em;
}
.context-info-description { color: #dfded5; font-size: 11px; }
.context-info-prompt { color: var(--accent-bright); font-size: 10px; }
.context-info[aria-expanded="true"] {
    background: rgba(9, 16, 18, 0.97);
}

.controls {
    right: calc(10px + var(--safe-right));
    bottom: calc(12px + var(--safe-bottom));
    gap: 9px;
}
.btn-stack { gap: 7px; }
.btn-round {
    position: relative;
    width: 52px;
    height: 52px;
    gap: 1px;
    border: 1px solid rgba(210, 192, 151, 0.48);
    background:
        radial-gradient(circle at 50% 20%, rgba(111, 183, 173, 0.13), transparent 48%),
        rgba(8, 15, 17, 0.86);
    color: #eee9db;
    font-size: 9px;
    letter-spacing: 0.04em;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28), inset 0 0 0 3px rgba(255, 255, 255, 0.025);
    backdrop-filter: blur(8px);
}
.btn-round::after {
    position: absolute;
    inset: 3px;
    border: 1px solid rgba(111, 183, 173, 0.12);
    border-radius: inherit;
    content: "";
    pointer-events: none;
}
.btn-round:active {
    border-color: var(--accent-bright);
    background: rgba(75, 60, 28, 0.92);
    transform: scale(0.96);
}
.control-glyph {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: #d8c591;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.control-label { display: block; line-height: 1.1; }
.btn-menu .control-glyph { stroke: #8dccbf; }
.btn-potion {
    background: radial-gradient(circle at 50% 25%, rgba(97, 173, 116, 0.22), transparent 55%), rgba(8, 18, 15, 0.9);
}
.btn-count {
    right: -2px;
    top: -3px;
    border: 1px solid #f1d08b;
    background: #873d36;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.btn-action {
    position: relative;
    min-width: 94px;
    height: 68px;
    padding: 22px 15px 0;
    border: 1px solid #efd078;
    border-radius: 24px;
    background:
        radial-gradient(circle at 50% 0, rgba(241, 207, 124, 0.32), transparent 52%),
        linear-gradient(180deg, rgba(91, 72, 29, 0.96), rgba(48, 38, 18, 0.96));
    color: #fff3cd;
    font-size: 15px;
    letter-spacing: 0.08em;
    box-shadow: 0 7px 22px rgba(0, 0, 0, 0.36), 0 0 18px rgba(217, 181, 104, 0.24), inset 0 0 0 3px rgba(255, 238, 190, 0.06);
}
.btn-action::before {
    position: absolute;
    left: 50%;
    top: 10px;
    width: 10px;
    height: 10px;
    border: 1px solid #ffe6a6;
    content: "";
    transform: translateX(-50%) rotate(45deg);
    box-shadow: inset 0 0 0 2px rgba(255, 230, 166, 0.08), 0 0 8px rgba(255, 220, 130, 0.4);
}
.btn-action-label { display: block; line-height: 1.15; }
.btn-action-progress {
    position: absolute;
    left: 50%;
    top: 5px;
    z-index: 1;
    display: none;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(#ffe6a6 var(--action-progress-angle, 0deg), rgba(255, 230, 166, 0.16) 0);
    color: #fff8df;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    transform: translateX(-50%);
    box-shadow: 0 0 9px rgba(255, 220, 130, 0.34);
}
.btn-action-progress::before {
    position: absolute;
    inset: 3px;
    border-radius: inherit;
    background: #4a3a1c;
    content: "";
}
.btn-action-count { position: relative; z-index: 1; }
.btn-action.is-progress {
    cursor: wait;
    opacity: 1;
    padding-top: 28px;
}
.btn-action.is-progress::before { display: none; }
.btn-action.is-progress .btn-action-progress { display: grid; }
.btn-action.is-progress:active { transform: none; }
.btn-action.is-complete {
    border-color: #b7dfad;
    color: #e6f7df;
}
.btn-action.is-complete .btn-action-progress {
    background: #9ed390;
    color: #183119;
}
.btn-action.is-complete .btn-action-progress::before,
.btn-action.is-cancelled .btn-action-progress::before { background: transparent; }
.btn-action.is-cancelled {
    border-color: #d79680;
    color: #ffe0d4;
}
.btn-action.is-cancelled .btn-action-progress {
    background: #9a5545;
    color: #fff4eb;
}

.hotbar {
    left: calc(10px + var(--safe-left));
    bottom: calc(12px + var(--safe-bottom));
    gap: 5px;
    padding: 6px;
    border: 1px solid rgba(210, 192, 151, 0.36);
    border-radius: 12px;
    background: rgba(8, 15, 17, 0.86);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34), inset 0 1px rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
}
.hotbar .slot {
    width: 50px;
    height: 52px;
    border: 1px solid rgba(168, 181, 171, 0.26);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(35, 47, 47, 0.92), rgba(17, 25, 28, 0.94));
    color: #dcd9cf;
}
.hotbar .slot.active {
    border-color: #e4bf70;
    background: linear-gradient(180deg, rgba(93, 74, 34, 0.95), rgba(43, 36, 20, 0.96));
    box-shadow: 0 0 0 2px rgba(228, 191, 112, 0.15), inset 0 0 12px rgba(241, 207, 124, 0.1);
}
.hotbar .slot-name { color: #c8c5ba; letter-spacing: 0.04em; }
.hotbar-fold {
    background: rgba(111, 183, 173, 0.08);
    color: #b8c8c3;
}
.hotbar-hint {
    border: 1px solid rgba(217, 181, 104, 0.28);
    background: rgba(8, 15, 17, 0.9);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(8px);
}

.sheet-backdrop { background: rgba(3, 8, 10, 0.12); backdrop-filter: none; }
.sheet {
    top: 50%;
    bottom: auto;
    left: 50%;
    width: min(620px, calc(100vw - 28px - var(--safe-left) - var(--safe-right)));
    height: min(74dvh, 680px);
    max-height: calc(100dvh - 40px - var(--safe-top) - var(--safe-bottom));
    background: linear-gradient(145deg, rgba(20, 37, 34, 0.84), rgba(9, 22, 23, 0.78) 65%, rgba(26, 33, 26, 0.82));
    border: 1px solid rgba(207, 182, 120, 0.65);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.3), inset 0 0 0 4px rgba(225, 203, 153, 0.035);
    color: #eeede0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.sheet::before { content: none; }
.sheet-header { flex: 0 0 auto; padding: 18px 18px 12px; gap: 10px; background: rgba(11, 25, 23, 0.65); }
.journal-identity { display: flex; gap: 12px; align-items: center; min-width: 0; }
.journal-mark { width: 38px; height: 38px; flex: 0 0 auto; fill: none; stroke: #cbb779; stroke-width: 1; }
.journal-mark path:last-child { fill: #cbb779; stroke: none; }
.journal-owner { min-width: 0; }
.journal-caption { display: block; margin-top: 3px; color: #bebba5; font-size: 10px; letter-spacing: 0.2em; }
.logo-small {
    color: var(--accent-bright);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 17px;
    letter-spacing: 0.26em;
    text-shadow: 0 0 14px rgba(217, 181, 104, 0.2);
}
.sheet-player { color: #b2b9b0; font-size: 11px; line-height: 1.7; margin-top: 5px; overflow-wrap: anywhere; }
.sheet-player strong { color: #f1eee5; }
.sheet-player .player-title { display: inline; color: #d1c59f; }
.sheet-close {
    flex: 0 0 44px;
    border: 1px solid rgba(210, 192, 151, 0.25);
    background: rgba(255, 255, 255, 0.035);
    color: #d8d4c8;
}
.sheet-close:hover, .sheet-close:focus-visible { background: rgba(229, 202, 141, 0.13); color: #fff4d4; }
.journal-watch {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 7px 12px; padding: 9px 18px; flex: 0 0 auto;
    border-block: 1px solid rgba(193, 193, 155, 0.12); background: rgba(4, 15, 14, 0.3);
}
.journal-watch-status { font-size: 10px; color: #b8c6b4; line-height: 1.5; }
.journal-watch-status::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 7px; border-radius: 50%; background: #a7bd8a; }
.journal-vitals { display: flex; align-items: center; gap: 7px; font-size: 10px; font-variant-numeric: tabular-nums; color: #d1d9be; }
.journal-vitals strong { font-weight: 500; min-width: 52px; text-align: right; }
.journal-vitals meter { width: 50px; height: 5px; border: none; background: rgba(0,0,0,0.35); border-radius: 4px; overflow: hidden; }
.journal-vitals meter::-webkit-meter-bar { border: none; background: rgba(0,0,0,0.35); height: 5px; }
.journal-vitals meter::-webkit-meter-optimum-value { background: #a9bd84; }
.journal-vitals meter::-moz-meter-bar { background: #a9bd84; }
.sheet.under-attack { border-color: #ec9881; box-shadow: 0 0 0 2px rgba(204, 92, 65, 0.3), 0 20px 55px rgba(0,0,0,0.3); }
.under-attack .journal-watch { background: rgba(99, 34, 25, 0.7); }
.under-attack .journal-watch-status { color: #ffe0d1; }
.under-attack .journal-watch-status::before { background: #ffaf8c; }
.tabs {
    flex: 0 0 auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    padding: 4px 8px 0;
    border-bottom-color: rgba(217, 181, 104, 0.18);
}
.tabs button {
    min-height: 44px;
    padding-inline: 2px;
    border-bottom-width: 2px;
    color: #b2b9ac;
    font-size: 12px;
    white-space: nowrap;
}
@media (min-width: 600px) {
    .tabs { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
.tabs button.active {
    color: #f1cf7c;
    border-bottom-color: #d9b568;
    text-shadow: 0 0 12px rgba(217, 181, 104, 0.25);
    background: linear-gradient(0deg, rgba(217,181,104,0.12), transparent);
}
.sheet-body { min-height: 0; flex: 1 1 auto; padding: 18px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #687361 transparent; }
.journal-section { margin-bottom: 18px; }
.journal-section > span, .journal-section > div > span { color: #b5b392; font: 9px Georgia, serif; letter-spacing: 0.15em; }
.journal-section h2 { margin: 5px 0 0; font: 500 21px/1.4 "Yu Mincho", "Hiragino Mincho ProN", serif; letter-spacing: 0.09em; color: #efe5c9; }
.journal-section-wallet { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet .gold-line { margin: 0; text-align: right; font-size: 10px; color: #b9bdaa; }
.sheet .gold { display: block; margin: 4px 0 0; font: 21px/1.2 Georgia, serif; color: #e8cf93; }
.sheet .panel-sub { display: flex; align-items: center; gap: 12px; margin: 20px 0 10px; font-size: 11px; color: #cdc7ae; letter-spacing: 0.12em; }
.sheet .panel-sub::after { content: ''; height: 1px; flex: 1; background: linear-gradient(90deg, rgba(209,191,145,0.25), transparent); }
.sheet .panel-lead { color: #bbc2b4; font-size: 12px; line-height: 1.8; }
.sheet .materials { gap: 8px; }
.sheet .materials li { border: 1px solid rgba(191,201,173,0.14); border-radius: 10px; padding: 12px; background: rgba(9,20,19,0.4); font-size: 13px; }
.sheet .consumables .inventory-entry { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; column-gap: 12px; row-gap: 10px; align-items: start; }
.sheet .mat-dot { margin: 5px 0 0; width: 9px; height: 9px; border-color: rgba(255,255,255,0.35); box-shadow: 0 0 0 3px rgba(213,197,156,0.06); }
.item-copy { min-width: 0; }
.item-copy strong { font-size: 13px; font-weight: 600; color: #eeecdc; }
.item-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.item-quantity { font: 12px Georgia, serif; color: #e4d4ab; white-space: nowrap; }
.item-description { display: block; margin-top: 6px; color: #bcc4b7; font-size: 11px; line-height: 1.8; overflow-wrap: anywhere; }
.item-actions { grid-column: 3; grid-row: 1; display: flex; justify-content: flex-end; gap: 8px; }
.has-multiple-actions .item-copy, .tool .item-copy { grid-column: 2 / -1; }
.has-multiple-actions .item-actions { grid-column: 2 / -1; grid-row: 2; }
.sheet .consumables button { min-height: 44px; min-width: 64px; padding: 5px 14px; border: 1px solid rgba(201,174,114,0.45); border-radius: 7px; background: rgba(137,107,55,0.18); color: #f3dfb5; font-size: 12px; cursor: pointer; }
.sheet .consumables button:hover { background: rgba(137,107,55,0.36); }
.item-condition { grid-column: 2 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #aebfa3; font-size: 10px; }
.item-condition .durability { flex: 0 0 75px; }
.sheet .material-entry { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.material-name { flex: 1; }
.sheet .mat-run { flex: 0 0 100%; padding-left: 19px; font-size: 10px; }
.sheet .info-list { gap: 8px; }
.sheet .info-list div { padding: 12px; border: 1px solid rgba(191,201,173,0.14); border-radius: 8px; background: rgba(9,20,19,0.3); }
.sheet .info-list dt { font-size: 11px; color: #bac3b3; }
.sheet .info-list dd { font-size: 13px; }
.sheet .weapons button { padding: 13px; font-size: 13px; line-height: 1.7; }
.sheet .weapons button.equipped { background: rgba(156,126,56,0.17); border-color: #bba064; }
.sheet .shop-list li { padding: 12px; background: rgba(9,20,19,0.38); border-radius: 10px; }
.sheet .shop-name { font-size: 13px; }
.sheet .menu-button { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; font-size: 12px; text-decoration: none; color: #eee5cf; }
.sheet button:focus-visible, .sheet a:focus-visible { outline: 2px solid #e4ca8e; outline-offset: -3px; }
.sheet .tool .tool-repair { grid-column: 2 / -1; grid-row: auto; justify-content: flex-end; }
.journal-footer { flex: 0 0 auto; display: flex; justify-content: space-between; gap: 8px; padding: 10px 18px; border-top: 1px solid rgba(196,184,141,0.15); background: rgba(11,25,23,0.65); color: #a9b29e; font: 10px/1.5 "Yu Mincho", serif; letter-spacing: 0.06em; }
.journal-footer .save-status { margin: 0; font: 10px/1.5 sans-serif; letter-spacing: 0; }
@media (min-width: 480px) {
    .sheet .consumables .inventory-entry { grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; }
    .has-multiple-actions .item-copy, .tool .item-copy { grid-column: 2; }
    .item-actions, .item-condition, .has-multiple-actions .item-actions { grid-column: 3; grid-row: 1; }
    .item-condition { flex-direction: column; align-items: flex-end; gap: 7px; }
    .item-condition .durability { flex-basis: auto; }
}
@media (max-height: 520px) {
    .sheet { height: calc(100dvh - 24px - var(--safe-top) - var(--safe-bottom)); max-height: calc(100dvh - 24px - var(--safe-top) - var(--safe-bottom)); }
    .sheet-header { padding-block: 10px; }
    .journal-mark { width: 28px; height: 28px; }
    .journal-caption, .journal-footer > span:first-child { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sheet { transition: none; } }
.info-list div,
.materials li,
.weapons button,
.menu-button,
.shop-list li,
.bs-row,
.camp-row {
    border-color: rgba(149, 165, 160, 0.16);
}
.weapons button,
.menu-button,
.shop-list li,
.bs-row,
.camp-row {
    background: rgba(255, 255, 255, 0.035);
}
.menu-button,
.weapons button { border-width: 1px; border-radius: 10px; }

.game-dialog {
    background: linear-gradient(180deg, #192326, #0d1517 72%);
    border: 1px solid #907a4e;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}
.game-dialog::backdrop { background: rgba(3, 8, 10, 0.7); backdrop-filter: blur(3px); }
.game-dialog h2 {
    color: var(--accent-bright);
    font-family: Georgia, "Yu Mincho", serif;
    letter-spacing: 0.06em;
}
.dialog-close,
.primary-button {
    border-radius: 10px;
}
.dialog-close {
    border: 1px solid rgba(210, 192, 151, 0.28);
    background: rgba(255, 255, 255, 0.04);
}
.primary-button {
    color: #201a0d;
    background: linear-gradient(180deg, #f0cf83, #c89f50);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.35);
}

@media (max-width: 390px) {
    .context-info { right: calc(68px + var(--safe-right)); padding-left: 42px; }
    .btn-round { width: 48px; height: 48px; }
    .btn-action { min-width: 86px; height: 64px; padding-inline: 12px; font-size: 14px; }
    .tabs button { font-size: 11px; }
}

@media (min-width: 700px) {
    .context-info { bottom: calc(18px + var(--safe-bottom)); width: 390px; }
}

@media (min-width: 720px) {
    .sheet {
        border: 1px solid #907a4e;
        border-radius: 16px;
        box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
    }
    .game-dialog { border: 1px solid #907a4e; border-radius: 16px; }
}

/* ---- スマホ操作ドック -------------------------------------------------------- */
.tap-walk-toggle {
    position: absolute;
    z-index: 6;
    left: calc(8px + var(--safe-left));
    top: 160px;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid rgba(210, 192, 151, 0.55);
    border-radius: 12px;
    color: #e7e1d3;
    background: rgba(10, 20, 21, 0.9);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    font: 700 10px/1.2 sans-serif;
    cursor: pointer;
    touch-action: manipulation;
    transition: opacity 180ms ease-out;
}
.tap-walk-toggle[aria-pressed="true"] {
    color: #241a0d;
    border-color: #e5c57d;
    background: linear-gradient(180deg, #f0d48f, #caa456);
}
.tap-walk-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.tap-walk-toggle.is-moving { opacity: 0.2; }
.tap-walk-toggle.is-moving:is(:focus-visible, :active) { opacity: 1; }
@media (hover: hover) {
    .tap-walk-toggle.is-moving:hover { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .tap-walk-toggle { transition: none; }
}
.controls {
    left: calc(8px + var(--safe-left));
    right: calc(8px + var(--safe-right));
    bottom: calc(8px + var(--safe-bottom));
    display: block;
    width: auto;
    max-width: 430px;
    margin-inline: auto;
}
.action-dock {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(72px, 1.15fr) repeat(2, minmax(0, 1fr));
    align-items: end;
    min-height: 56px;
    padding: 3px;
    gap: 4px;
    border: 1px solid rgba(210, 192, 151, 0.38);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(22, 31, 32, 0.94), rgba(7, 13, 15, 0.97)),
        rgba(8, 15, 17, 0.95);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.42), inset 0 1px rgba(255, 245, 214, 0.06);
    backdrop-filter: blur(14px) saturate(120%);
    pointer-events: auto;
}
.action-dock .btn-round {
    width: 100%;
    min-width: 48px;
    height: 48px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    box-shadow: none;
    font-size: 10px;
}
.action-dock .control-glyph { width: 18px; height: 18px; }
.action-dock button:focus-visible { outline: 2px solid #fff3cd; outline-offset: 0; }
.action-dock .btn-round::after {
    inset: 4px;
    border-color: rgba(210, 192, 151, 0.1);
    border-radius: 8px;
}
.action-dock .dock-notice-dot {
    position: absolute;
    z-index: 1;
    top: 5px;
    right: 8px;
    width: 11px;
    height: 11px;
    border: 2px solid #151e1f;
    border-radius: 50%;
    background: #e6534e;
    box-shadow: 0 0 0 1px #f6a58f;
}
.action-dock .dock-notice-dot[hidden] { display: none; }
.action-dock .btn-round:active,
.action-dock .btn-round.active {
    background: linear-gradient(180deg, rgba(102, 81, 36, 0.7), rgba(45, 38, 23, 0.7));
}
.action-dock .btn-round:disabled {
    cursor: default;
    opacity: 0.38;
}
.action-dock .btn-round:disabled:active { transform: none; }
.action-dock .btn-round.has-selection:not(.active) {
    color: #fff0c0;
    background: rgba(101, 78, 30, 0.34);
}
.action-dock .btn-round.has-selection .control-glyph { stroke: #f1cf7d; }
.dock-primary-slot {
    position: relative;
    display: grid;
    min-width: 0;
    height: 48px;
    place-items: center;
}
.dock-primary-rest {
    width: 18px;
    height: 18px;
    border: 1px solid rgba(217, 181, 104, 0.36);
    transform: rotate(45deg);
    box-shadow: inset 0 0 0 4px rgba(217, 181, 104, 0.04);
}
.dock-primary-slot .btn-action {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 100%;
    min-width: 48px;
    height: 48px;
    padding: 12px 6px 0;
    border-radius: 11px;
    font-size: 13px;
    transform: translateX(-50%);
}
.dock-primary-slot .btn-action::before { top: 5px; width: 8px; height: 8px; }
.dock-primary-slot .btn-action.is-progress { padding-top: 22px; font-size: 11px; letter-spacing: 0; }
.dock-primary-slot .btn-action-progress { top: 3px; width: 20px; height: 20px; }
.dock-primary-slot .btn-action:active { transform: translateX(-50%) scale(0.96); }
.dock-primary-slot .btn-action.is-progress:active { transform: translateX(-50%); }
.dock-potion {
    position: absolute;
    right: 4px;
    bottom: 64px;
    width: 48px;
    height: 48px;
    z-index: 2;
}

/* ドックから開く道具パレット。選んだ後は閉じ、選択中は道具ボタンを点灯する。 */
.hotbar {
    left: calc(8px + var(--safe-left));
    right: calc(8px + var(--safe-right));
    bottom: calc(72px + var(--safe-bottom));
    width: auto;
    max-width: 414px;
    margin-inline: auto;
    padding: 6px;
    overflow: hidden;
    border-radius: 14px;
}
.hotbar.folded { display: none; }
.hotbar-slots {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}
.hotbar-slots::-webkit-scrollbar { display: none; }
.hotbar-fold,
.hotbar.folded .hotbar-fold {
    flex: 0 0 42px;
    width: 42px;
    height: 52px;
    font-size: 20px;
}
.hotbar-hint { bottom: calc(72px + var(--safe-bottom)); }
.hotbar:not([hidden]):not(.folded) + .hotbar-hint { bottom: calc(138px + var(--safe-bottom)); }
.hotbar:not([hidden]):not(.folded) ~ .controls .dock-potion { bottom: 130px; }

.context-info {
    left: calc(10px + var(--safe-left));
    right: calc(66px + var(--safe-right));
    bottom: calc(72px + var(--safe-bottom));
    max-width: none;
}
.hotbar:not([hidden]):not(.folded) ~ .context-info {
    bottom: calc(142px + var(--safe-bottom));
}

/* 冒険者たちの声。閉じている時は世界を隠さない細い帯、開いた時だけ会話面になる。 */
.adventurer-voices {
    position: absolute;
    z-index: 7;
    left: calc(8px + var(--safe-left));
    bottom: calc(84px + var(--safe-bottom));
    width: 44px;
    color: #eee7d8;
    font-size: 12px;
    pointer-events: auto;
    touch-action: pan-y;
    user-select: text;
    -webkit-user-select: text;
}
.voices-toggle {
    position: relative;
    display: grid;
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    color: #f4ead1;
    background: rgba(7, 18, 19, 0.7);
    border: 1px solid rgba(218, 187, 119, 0.36);
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28), inset 0 1px rgba(255, 245, 214, 0.055);
    backdrop-filter: blur(8px) saturate(108%);
    cursor: pointer;
    place-items: center;
}
.voices-toggle:focus-visible,
.voices-close:focus-visible,
.voices-form input:focus-visible,
.voices-form button:focus-visible { outline: 2px solid #ffe6a6; outline-offset: 2px; }
.voices-sigil {
    display: grid;
    width: 28px;
    height: 28px;
    color: #e6c472;
    place-items: center;
}
.voices-sigil svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.voices-unread {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    min-width: 12px;
    height: 12px;
    background: #e6534e;
    border: 2px solid #111b1c;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(255, 159, 141, 0.72);
    pointer-events: none;
}
.voices-unread[hidden] { display: none; }
.voices-float-layer {
    position: absolute;
    z-index: 4;
    top: calc(116px + var(--safe-top));
    right: calc(12px + var(--safe-right));
    bottom: calc(184px + var(--safe-bottom));
    left: calc(12px + var(--safe-left));
    overflow: visible;
    pointer-events: none;
}
.voices-floating-message {
    position: absolute;
    top: var(--voice-y);
    left: var(--voice-x);
    width: max-content;
    max-width: min(66vw, 260px);
    padding: 7px 10px 8px;
    color: #eee8dc;
    background: linear-gradient(135deg, rgba(10, 22, 23, 0.8), rgba(16, 25, 27, 0.66));
    border: 1px solid rgba(218, 187, 119, 0.34);
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.24), inset 0 1px rgba(255, 247, 220, 0.06);
    backdrop-filter: blur(7px) saturate(108%);
    opacity: 0;
    transform: translate(-50%, calc(-50% + 7px)) scale(0.97);
    animation: voices-floating-message 5.2s ease-out both;
}
.voices-floating-message strong {
    display: block;
    margin-bottom: 2px;
    overflow: hidden;
    color: #e6c472;
    font-size: 9px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.voices-floating-message span {
    display: -webkit-box;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
@keyframes voices-floating-message {
    0% { opacity: 0; transform: translate(-50%, calc(-50% + 7px)) scale(0.97); }
    13%, 76% { opacity: 0.92; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(calc(-50% + var(--voice-drift)), calc(-50% - 16px)) scale(0.99); }
}
@media (prefers-reduced-motion: reduce) {
    .voices-floating-message {
        opacity: 0.92;
        transform: translate(-50%, -50%);
        animation: none;
    }
}
.adventurer-voices.is-open {
    right: calc(8px + var(--safe-right));
    left: calc(8px + var(--safe-left));
    width: auto;
    max-width: 430px;
    margin-inline: auto;
}
.adventurer-voices.is-open .voices-toggle { display: none; }
.voices-panel {
    display: grid;
    grid-template-rows: auto minmax(130px, 1fr) auto;
    max-height: min(52dvh, 430px);
    overflow: hidden;
    background:
        radial-gradient(circle at 18% 0, rgba(218, 184, 104, 0.1), transparent 36%),
        linear-gradient(180deg, rgba(24, 34, 35, 0.98), rgba(8, 15, 17, 0.99));
    border: 1px solid rgba(218, 187, 119, 0.62);
    border-radius: 16px;
    box-shadow: 0 15px 42px rgba(0, 0, 0, 0.56), inset 0 1px rgba(255, 247, 220, 0.08);
    backdrop-filter: blur(16px) saturate(120%);
}
.voices-panel[hidden] { display: none; }
.voices-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 52px;
    padding: 8px 9px 8px 13px;
    border-bottom: 1px solid rgba(216, 190, 131, 0.22);
}
.voices-header > div { display: grid; gap: 2px; }
.voices-header span { color: #998b6e; font: 700 8px/1 sans-serif; letter-spacing: 0.18em; }
.voices-header strong { color: #f0d08a; font: 700 14px/1.25 serif; }
.voices-close {
    width: 36px;
    height: 36px;
    color: #cfc6b3;
    font-size: 22px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(210, 192, 151, 0.22);
    border-radius: 10px;
    cursor: pointer;
}
.voices-list {
    display: grid;
    align-content: start;
    gap: 7px;
    min-height: 0;
    margin: 0;
    padding: 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
    scrollbar-color: rgba(218, 187, 119, 0.35) transparent;
}
.voices-list:empty::before {
    content: "まだ声はない。焚火のはぜる音だけが聞こえる。";
    padding: 28px 12px;
    color: #989486;
    font: 12px/1.7 serif;
    text-align: center;
}
.voices-message {
    padding: 7px 9px;
    background: rgba(255, 255, 255, 0.035);
    border-left: 2px solid rgba(196, 175, 127, 0.28);
    border-radius: 2px 9px 9px 2px;
}
.voices-message.own { background: rgba(218, 177, 86, 0.075); border-left-color: #d5ad59; }
.voices-message-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.voices-message-meta strong { min-width: 0; overflow: hidden; color: #d8c28e; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.voices-message-meta time { flex: none; color: #777a74; font-size: 9px; }
.voices-message p { margin: 3px 0 0; overflow-wrap: anywhere; color: #ebe6db; font-size: 12px; line-height: 1.55; }
.voices-form { display: grid; gap: 5px; padding: 9px 10px 10px; border-top: 1px solid rgba(216, 190, 131, 0.22); background: rgba(5, 11, 13, 0.48); }
.voices-form label { color: #a99d82; font-size: 9px; letter-spacing: 0.08em; }
.voices-compose { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.voices-compose input {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 9px 10px;
    color: #f3eee3;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(210, 192, 151, 0.28);
    border-radius: 9px;
    font: inherit;
}
.voices-compose input::placeholder { color: #7f827c; }
.voices-compose button {
    min-width: 64px;
    min-height: 42px;
    padding: 8px 11px;
    color: #281d0c;
    background: linear-gradient(180deg, #efd38d, #c9a351);
    border: 0;
    border-radius: 9px;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.34);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}
.voices-compose button:disabled { cursor: wait; opacity: 0.55; }
.voices-form-meta { display: flex; justify-content: space-between; gap: 8px; color: #7f837e; font-size: 9px; }
.voices-form-meta span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voices-form-meta .error { color: #ff9a88; }
#context-info:not([hidden]) ~ .adventurer-voices:not(.is-open) { bottom: calc(146px + var(--safe-bottom)); }
.hotbar:not([hidden]):not(.folded) ~ .adventurer-voices:not(.is-open) { bottom: calc(212px + var(--safe-bottom)); }

.menu-quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.menu-button-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.menu-button-icon .control-glyph { width: 18px; height: 18px; }

@media (max-width: 359px) {
    .controls { left: calc(5px + var(--safe-left)); right: calc(5px + var(--safe-right)); }
    .action-dock { gap: 1px; padding-inline: 4px; }
    .action-dock .btn-round { font-size: 9px; }
}

@media (min-width: 700px) {
    .context-info {
        left: calc(12px + var(--safe-left));
        right: auto;
        bottom: calc(72px + var(--safe-bottom));
        width: 390px;
    }
    .hotbar:not([hidden]):not(.folded) ~ .context-info { bottom: calc(142px + var(--safe-bottom)); }
}

/* スマホでは下端まで背景をつなぎ、ホームバーの上に操作を置く。 */
@media (max-width: 699px) {
    .controls {
        left: 0;
        right: 0;
        bottom: 0;
        max-width: none;
    }
    .action-dock {
        min-height: calc(56px + var(--safe-bottom));
        padding: 3px calc(8px + var(--safe-right)) calc(3px + var(--safe-bottom)) calc(8px + var(--safe-left));
        border-inline: 0;
        border-bottom: 0;
        border-radius: 0;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2);
    }
    .dock-potion {
        right: calc(10px + var(--safe-right));
        bottom: calc(64px + var(--safe-bottom));
    }
    .hotbar,
    .hotbar-hint,
    .context-info { bottom: calc(64px + var(--safe-bottom)); }
    .hotbar:not([hidden]):not(.folded) + .hotbar-hint { bottom: calc(130px + var(--safe-bottom)); }
    .hotbar:not([hidden]):not(.folded) ~ .context-info { bottom: calc(134px + var(--safe-bottom)); }
    .hotbar:not([hidden]):not(.folded) ~ .controls .dock-potion { bottom: calc(130px + var(--safe-bottom)); }
}
@media (max-width: 359px) {
    .action-dock {
        padding-left: calc(4px + var(--safe-left));
        padding-right: calc(4px + var(--safe-right));
    }
}

/* 食堂 */
.food-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; font-size: 13px; color: #e8dcc0; }
.food-status .grow { flex: 1; }
.food-meter { display: inline-block; width: 110px; height: 7px; border-radius: 4px; background: rgba(255,255,255,0.12); overflow: hidden; }
.food-meter span { display: block; height: 100%; background: #d9b568; border-radius: 4px; transition: width 0.3s; }
.food-hunger { color: #e8b872; font-size: 12px; }

/* 旬・凶作・行き倒れ */
.cook-season { margin-left: 6px; padding: 0 5px; border-radius: 4px; background: #5a8a3a; color: #f0ffe0; font-size: 11px; }
.cook-offseason { margin-left: 6px; color: #9a9480; font-size: 11px; }
.recipe-count { color: #e8d49a; }
.cook-rank { margin-left: 6px; padding: 0 5px; border-radius: 4px; background: #3a3530; color: #d8cfb8; font-size: 11px; }
.cook-rank.master { background: #8a6a1a; color: #fff3c8; }
.recipe-unknown { opacity: 0.6; }
.recipe-unknown .cook-name, .recipe-unknown .bs-name { letter-spacing: 2px; }
.recipe-hint { color: #9a9480; font-size: 12px; }
.shop-list li.sold-out { opacity: 0.55; }
.harvest-note { color: #e8b872; }
.collapse-actions { display: flex; justify-content: center; margin: 10px 0 4px; }
.collapse-actions button { min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid #8a5a4a; background: #3a2420; color: #f6d0c4; font-size: 13px; }

/* 旅の手帳・手紙・仲間 */
.pilgrim-series { margin: 0 0 12px; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,0.05); }
.pilgrim-title { font-size: 14px; color: #f3e2b0; }
.pilgrim-count { color: #ffd86a; font-size: 13px; }
.pilgrim-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; font-size: 13px; color: #d8d2c0; }
.pilgrim-list li.visited { color: #ffe7a0; }
.letter-text { font-size: 15px; line-height: 1.8; color: #f3ead0; background: rgba(255,248,230,0.06); border-left: 3px solid #c8a060; padding: 10px 12px; border-radius: 6px; margin: 8px 0; }
.companion-name { width: 6.5em; min-height: 32px; border-radius: 6px; border: 1px solid #5a5446; background: #1e1b16; color: #f0e8d0; padding: 0 6px; font-size: 13px; }
#journey-companions li.locked { opacity: 0.7; }
.pilgrim-series .ach-desc { display: block; font-size: 12px; color: #b8b0a0; margin-top: 2px; }
#journey-companions .ach-desc { display: block; font-size: 12px; color: #b8b0a0; }

/* パレット：掘る */
.slot-dig { background:
    linear-gradient(135deg, transparent 44%, #8a6038 44% 56%, transparent 56%) 0 0 / 16px 16px no-repeat,
    radial-gradient(ellipse 7px 5px at 15px 15px, #c8c0b0 90%, transparent 100%),
    radial-gradient(ellipse 10px 4px at 11px 19px, #6e5234 90%, transparent 100%); }
.slot-stairs { background:
    repeating-linear-gradient(0deg, #40372d 0 3px, #b2966a 3px 5px) center 7px / 22px 17px no-repeat,
    radial-gradient(ellipse 13px 8px at 16px 19px, #171410 95%, transparent 100%); }
.slot-tunnel { background:
    radial-gradient(circle at 16px 17px, #151516 0 8px, #71604d 9px 12px, transparent 13px),
    linear-gradient(135deg, transparent 44%, #9a7048 44% 55%, transparent 56%); }
.slot-dig-up { background:
    linear-gradient(135deg, transparent 42%, #f0d99b 43% 57%, transparent 58%),
    radial-gradient(ellipse at 50% 70%, #33271c 0 44%, #9a805e 46% 57%, transparent 59%); }
.slot-support { background:
    linear-gradient(90deg, transparent 14%, #8c5b31 15% 28%, transparent 29% 71%, #8c5b31 72% 85%, transparent 86%),
    linear-gradient(#bd8951, #bd8951) 2px 3px / 18px 5px no-repeat; border-radius: 0; }

/* 二重ログイン：別の画面で開かれて止まった */
.session-dialog { max-width: 420px; }
.session-note { color: #9a9480; font-size: 13px; }

/* ---- RIMVANE ダイアログシステム -------------------------------------------- */
.game-dialog {
    --dialog-accent: #d9b568;
    --dialog-accent-bright: #f0cf83;
    --dialog-line: rgba(217, 181, 104, 0.22);
    --dialog-surface: rgba(255, 255, 255, 0.035);
    width: min(600px, calc(100vw - 20px));
    max-height: min(88dvh, 760px);
    padding: 14px;
    color: #d8dedb;
    background:
        radial-gradient(circle at 12% 0, rgba(95, 130, 120, 0.11), transparent 34%),
        linear-gradient(180deg, #172326 0%, #0b1315 72%, #091012 100%);
    border-color: rgba(217, 181, 104, 0.58);
    border-radius: 18px;
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.58),
        inset 0 1px rgba(255, 244, 213, 0.07),
        inset 0 0 0 1px rgba(120, 157, 147, 0.04);
    font-size: 13px;
    line-height: 1.55;
    scrollbar-color: rgba(217, 181, 104, 0.4) transparent;
    scrollbar-width: thin;
    overscroll-behavior: contain;
}
.game-dialog::backdrop {
    background: rgba(2, 7, 9, 0.76);
    backdrop-filter: blur(4px) saturate(82%);
}
.game-dialog h2 {
    margin: 0 0 7px;
    padding: 0 0 8px;
    color: var(--dialog-accent-bright);
    border-bottom: 1px solid var(--dialog-line);
    font-family: Georgia, "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0.08em;
    text-shadow: 0 0 16px rgba(217, 181, 104, 0.18);
}
.game-dialog .dialog-lead {
    margin: 0 0 9px;
    color: #9da8a5;
    font-size: 12px;
    line-height: 1.6;
}
.game-dialog .dialog-message {
    min-height: 1.45em;
    margin-block: 7px 5px;
    font-size: 12px;
    line-height: 1.5;
}
.game-dialog .gold {
    margin-left: 5px;
    color: #e9c66f;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: 0.03em;
}
.game-dialog .panel-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 5px;
    color: #b7c1bd;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.45;
    letter-spacing: 0.08em;
}
.game-dialog .panel-sub::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(149, 165, 160, 0.2), transparent);
}
.game-dialog .shop-list,
.game-dialog .blacksmith-list,
.game-dialog .camp-actions,
.game-dialog .news-list {
    gap: 5px;
}
.game-dialog .shop-list li,
.game-dialog .bs-row,
.game-dialog .camp-row,
.game-dialog .news-list li,
.game-dialog .pilgrim-series,
.game-dialog .letter-text {
    border: 1px solid rgba(149, 165, 160, 0.12);
    background: linear-gradient(105deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}
.game-dialog .shop-list li {
    gap: 7px;
    padding: 7px 8px;
    border-radius: 9px;
    font-size: 13px;
    line-height: 1.45;
}
.game-dialog .shop-list .shop-name {
    min-width: 0;
    color: #dce2df;
    overflow-wrap: anywhere;
}
.game-dialog .shop-list .shop-price {
    min-width: 42px;
    color: #e7c45f;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
:is(#quest-board, #quest-active, #letter-offers, #letter-carrying, #journey-letters) li {
    flex-wrap: wrap;
}
:is(#quest-board, #quest-active, #letter-offers, #letter-carrying, #journey-letters) .shop-name,
:is(#quest-board, #quest-active, #letter-offers, #letter-carrying, #journey-letters) .ach-desc {
    flex: 1 1 100%;
    min-width: 0;
}
:is(#quest-board, #quest-active, #letter-offers, #letter-carrying, #journey-letters) .ach-desc {
    display: block;
    color: #b8c9c3;
    font-size: 12px;
}
:is(#quest-board, #quest-active, #letter-offers, #letter-carrying, #journey-letters) .shop-price {
    margin-right: auto;
}
.game-dialog .shop-list button,
.game-dialog .consumables button,
.game-dialog .bs-row button,
.game-dialog .camp-row button,
.game-dialog .fac-mat button,
.game-dialog .req-form button {
    min-height: 40px;
    padding-inline: 11px;
    border: 1px solid rgba(217, 181, 104, 0.36);
    border-radius: 9px;
    background: linear-gradient(180deg, rgba(83, 70, 45, 0.72), rgba(39, 35, 27, 0.84));
    color: #ece5d5;
    font-size: 12px;
    box-shadow: inset 0 1px rgba(255, 247, 225, 0.05);
}
.game-dialog .bs-row {
    gap: 5px 10px;
    padding: 8px 10px;
    border-radius: 9px;
    font-size: 13px;
}
.game-dialog .bs-cost,
.game-dialog .cook-effect,
.game-dialog .cook-hunger,
.game-dialog .fac-text,
.game-dialog .fac-mat,
.game-dialog .contributors,
.game-dialog .recipe-hint {
    font-size: 11px;
}
.game-dialog .camp-row {
    gap: 8px;
    padding: 7px 9px;
    border-radius: 9px;
}
.game-dialog .camp-text,
.game-dialog .food-status,
.game-dialog .req-form,
.game-dialog .worldmap-info {
    font-size: 12px;
}
.game-dialog .news-list li {
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.55;
}
.game-dialog.newspaper .news-list {
    gap: 6px;
    margin-bottom: 9px;
}
.game-dialog.newspaper .news-list li {
    --news-accent: #66817d;
    position: relative;
    overflow: hidden;
    padding: 8px 10px 8px 13px;
    border: 1px solid rgba(137, 161, 155, 0.11);
    border-radius: 9px;
    background:
        linear-gradient(100deg, color-mix(in srgb, var(--news-accent) 8%, transparent), transparent 42%),
        rgba(255, 255, 255, 0.025);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.022);
}
.game-dialog.newspaper .news-list li::before {
    content: "";
    position: absolute;
    inset: 7px auto 7px 0;
    width: 2px;
    border-radius: 0 2px 2px 0;
    background: var(--news-accent);
    box-shadow: 0 0 10px color-mix(in srgb, var(--news-accent) 28%, transparent);
}
.game-dialog.newspaper .news-list li.player_death { --news-accent: #b76562; }
.game-dialog.newspaper .news-list li.chest_found { --news-accent: #a683bd; }
.game-dialog.newspaper .news-list li.region_discovered { --news-accent: #7199b7; }
.game-dialog.newspaper .news-list li.named_spawn,
.game-dialog.newspaper .news-list li.named_defeated,
.game-dialog.newspaper .news-list li.landmark_first,
.game-dialog.newspaper .news-list li.region_completed { --news-accent: #d9b568; }
.game-dialog.newspaper .news-list li.region_event { --news-accent: #c8874d; }
.game-dialog.newspaper .news-list li.named_escape { --news-accent: #b96347; }
.game-dialog.newspaper .news-time {
    display: block;
    color: #81918d;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
    letter-spacing: 0.025em;
}
.game-dialog.newspaper .news-body {
    display: block;
    margin-top: 2px;
    color: #d5dcd9;
    font-size: 11px;
    line-height: 1.6;
    letter-spacing: 0.015em;
    overflow-wrap: anywhere;
}
.game-dialog.newspaper .news-list .empty {
    padding-block: 10px;
    color: #8f9c98;
    font-size: 11px;
}
.game-dialog.newspaper .news-list .empty::before { background: #536662; }
.game-dialog .shop-tabs,
.game-dialog .worldmap-tabs {
    gap: 4px;
    margin-block: 3px 8px;
    padding: 3px;
    border-color: var(--dialog-line);
    background: rgba(0, 0, 0, 0.22);
}
.game-dialog .shop-tabs button,
.game-dialog .worldmap-tabs button {
    min-height: 40px;
    font-size: 12px;
    letter-spacing: 0.04em;
}
.game-dialog .shop-tabs button.active,
.game-dialog .worldmap-tabs button.active {
    border-color: rgba(217, 181, 104, 0.45);
    background: linear-gradient(180deg, rgba(217, 181, 104, 0.18), rgba(217, 181, 104, 0.07));
    color: #f0d58f;
}
.game-dialog .dialog-close,
.game-dialog .primary-button {
    min-height: 44px;
    border-radius: 10px;
    font-size: 13px;
    letter-spacing: 0.06em;
}
.game-dialog .dialog-close {
    margin-top: 5px;
    border: 1px solid rgba(149, 165, 160, 0.3);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
    color: #cbd2ce;
}
.game-dialog .primary-button {
    border: 1px solid rgba(255, 230, 169, 0.3);
    background: linear-gradient(180deg, #e5c378, #bc9349);
}
.game-dialog button:not(:disabled) {
    transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease, transform 80ms ease;
}
.game-dialog button:not(:disabled):active { transform: translateY(1px); }
.game-dialog button:focus-visible {
    outline: 2px solid rgba(240, 207, 131, 0.9);
    outline-offset: 2px;
}
.game-dialog .letter-text {
    margin-block: 7px;
    padding: 9px 10px;
    border-left: 2px solid var(--dialog-accent);
    font-size: 13px;
    line-height: 1.75;
}
.game-dialog .message-preview { font-size: 16px; }

@media (max-width: 390px) {
    .game-dialog {
        width: calc(100vw - 16px);
        padding: 12px;
        border-radius: 16px;
    }
    .game-dialog h2 { font-size: 15px; }
    .game-dialog .shop-list li { padding-inline: 7px; }
    .game-dialog .shop-list button,
    .game-dialog .consumables button { padding-inline: 10px; }
}

/* 施設ウィンドウはスマホで下から開く。旅人の手帳は中央表示を保つ。 */
@media (max-width: 699px) {
    .game-dialog {
        width: 100%;
        max-width: none;
        max-height: min(58dvh, 620px);
        margin-block: auto 0;
        margin-inline: 0;
        padding-bottom: calc(12px + var(--safe-bottom));
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 20px 20px 0 0;
    }
    .game-dialog::before {
        content: "";
        display: block;
        width: 42px;
        height: 4px;
        margin: -5px auto 10px;
        border-radius: 999px;
        background: rgba(217, 181, 104, 0.48);
    }
    .game-dialog::backdrop {
        background: linear-gradient(180deg, rgba(2, 7, 9, 0.16), rgba(2, 7, 9, 0.48));
        backdrop-filter: none;
    }
    .game-dialog[open] { animation: mobile-dialog-sheet-in 0.18s ease-out; }
    .game-dialog.worldmap-dialog {
        max-height: calc(100dvh - 12px - var(--safe-top));
    }
}

@keyframes mobile-dialog-sheet-in {
    from { transform: translateY(24px); opacity: 0.75; }
    to { transform: translateY(0); opacity: 1; }
}

/* 鍛冶屋は街の景色を残しつつ、中央で装備と費用を見比べる。 */
.blacksmith-dialog {
    width: min(540px, calc(100vw - 20px));
    max-height: min(72dvh, 680px);
    padding: 12px;
    border: 1px solid rgba(217, 181, 104, 0.58);
    border-radius: 18px;
}
.blacksmith-dialog::before { content: none; display: none; }
.blacksmith-dialog::backdrop {
    background: rgba(2, 7, 9, 0.58);
    backdrop-filter: blur(2px) saturate(88%);
}
.blacksmith-dialog[open] {
    position: fixed;
    inset: 50% auto auto 50%;
    margin: 0;
    transform: translate(-50%, -50%);
    animation: none;
}
.blacksmith-dialog h2 {
    margin-bottom: 5px;
    padding-bottom: 6px;
    font-size: 15px;
}
.blacksmith-dialog .dialog-lead {
    margin-bottom: 7px;
    font-size: 11px;
    line-height: 1.5;
}
.blacksmith-dialog .blacksmith-list { gap: 4px; }
.blacksmith-dialog .bs-row {
    grid-template-columns: minmax(0, 1fr) minmax(76px, auto);
    gap: 3px 8px;
    padding: 7px 8px;
    font-size: 12px;
    line-height: 1.35;
}
.blacksmith-dialog .bs-name {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 1px 8px;
    overflow-wrap: anywhere;
}
.blacksmith-dialog .bs-item-name {
    color: #e3e7e3;
    font-size: 12px;
    font-weight: 650;
}
.blacksmith-dialog .bs-stats {
    color: #b9dcf0;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.blacksmith-dialog .bs-effect {
    flex-basis: 100%;
    color: #c9baa0;
    font-size: 10px;
    font-weight: 500;
}
.blacksmith-dialog .bs-cost {
    display: flex;
    flex-wrap: wrap;
    gap: 1px 8px;
    line-height: 1.4;
    font-size: 10px;
}
.blacksmith-dialog .bs-row button {
    min-width: 76px;
    min-height: 40px;
    padding-inline: 9px;
    font-size: 11px;
}
.blacksmith-dialog .bs-reforge {
    margin-left: 8px;
    border-left-color: rgba(139, 194, 226, 0.42);
    background: linear-gradient(105deg, rgba(89, 142, 171, 0.11), rgba(255, 255, 255, 0.018));
}
.blacksmith-dialog .panel-sub {
    margin: 8px 0 4px;
    font-size: 10px;
}
.blacksmith-dialog .recipe-count { margin-bottom: 5px; }
.blacksmith-dialog .blacksmith-close {
    position: sticky;
    bottom: -12px;
    z-index: 2;
    margin: 7px -12px -12px;
    padding: 7px 12px 10px;
    background: linear-gradient(180deg, rgba(9, 16, 18, 0), #091012 34%);
}
.blacksmith-dialog .blacksmith-close .dialog-close {
    min-height: 40px;
    margin-top: 0;
    font-size: 12px;
}

@media (max-width: 390px) {
    .blacksmith-dialog {
        width: calc(100vw - 12px);
        max-height: 74dvh;
        padding: 10px;
    }
    .blacksmith-dialog .bs-row {
        grid-template-columns: minmax(0, 1fr) 76px;
        padding-inline: 7px;
    }
    .blacksmith-dialog .blacksmith-close {
        bottom: -10px;
        margin: 7px -10px -10px;
        padding-inline: 10px;
    }
}

/* 旅の足跡（ログイン時の報告） */
.footprint-list { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 8px; }
.footprint-list li { padding: 10px 12px; border-radius: 8px; background: rgba(255,240,210,0.06); border-left: 3px solid #d9b568; color: #f0e6cc; font-size: 14px; line-height: 1.6; }

/* 持ち物の道具：説明は2行目に小さく */
.consumables li.tool .tool-hint { display: block; margin-top: 2px; font-size: 11px; line-height: 1.4; color: #9a9480; }
.consumables li.tool button { white-space: nowrap; }

/* 旅の出会い */
.encounter-text { font-size: 15px; line-height: 1.8; color: #f0e6cc; margin: 6px 0 12px; }
.tavern-conversation { min-height: 5em; margin: 12px 0; padding: 12px; border: 1px solid #65543d; border-radius: 8px; background: #211e19; color: #f0e8d0; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.encounter-options { display: grid; gap: 8px; margin-bottom: 8px; }
.encounter-options button { min-height: 42px; border-radius: 8px; border: 1px solid #6a6450; background: #2e2a22; color: #f0e8d0; font-size: 14px; text-align: left; padding: 0 14px; }
.encounter-options button:disabled { opacity: 0.45; }

/* 武器屋：説明は2行目に */
#weapon-shop-list .ach-desc { display: block; margin-top: 2px; font-size: 12px; color: #b8b0a0; }

/* 乗合馬車：行き先の説明は2行目に */
#coach-list .ach-desc { display: block; margin-top: 2px; font-size: 12px; color: #b8b0a0; }

.dark-world-dialog { max-width: 520px; max-height: 85dvh; overflow-y: auto; color: #eee5ee; background: #221d30; border: 1px solid #84718f; }
.dark-world-dialog::backdrop { background: #090712aa; }
.dark-world-dialog h2 { color: #f3dba6; }
.dark-world-dialog .dark-story-line { font-size: 14px; line-height: 1.9; margin: 14px 0; }
.dark-world-dialog button { display: block; min-height: 44px; width: 100%; margin-top: 18px; padding: 10px 16px; background: #594568; color: #fff2d5; border: 1px solid #9983a4; border-radius: 8px; }
.dark-eyebrow { color: #c0abc9; font-size: 11px; letter-spacing: .18em; }
.dark-journal { margin: 12px 0 20px; padding: 14px; background: #251f30; border: 1px solid #66576f; border-radius: 10px; color: #ece0ed; }
.dark-journal h3 { color: #f3dba6; margin: 0 0 10px; }
.dark-journal p, .dark-journal li { font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.dark-journal details { margin-top: 10px; border-top: 1px solid #55465f; padding-top: 8px; }
.dark-journal summary { min-height: 32px; cursor: pointer; color: #d9c4ef; }
.dark-reward { color: #f1d293; font-weight: 600; }
.dark-keepsakes { color: #c5b6ce; }
.dark-world-map { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid #7a6785; margin: 12px 0; }

/* 主人公の外見選択：設定画面は現在の外見だけを見せ、候補は専用ダイアログで探す。 */
.avatar-picker-control { min-width: 0; }
.avatar-current-card {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-width: 0;
    padding: 9px;
    border: 1px solid rgba(149, 165, 160, 0.24);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
}
.avatar-current-image {
    display: block;
    width: 72px;
    height: 72px;
    object-fit: contain;
}
.avatar-current-copy { display: grid; gap: 2px; min-width: 0; }
.avatar-current-copy small,
.avatar-picker-selection small { color: #929e9a; font-size: 10px; letter-spacing: 0.08em; }
.avatar-current-copy strong,
.avatar-picker-selection strong { color: var(--accent-bright); font-size: 14px; line-height: 1.35; }
.avatar-current-copy > span,
.avatar-picker-selection span > span { color: var(--muted); font-size: 11px; line-height: 1.45; }
.avatar-picker-open,
.auth-form .avatar-picker-open {
    min-height: 44px;
    margin: 0;
    padding: 8px 12px;
    color: #eee5cf;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(210, 192, 151, 0.34);
    border-radius: 9px;
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
    cursor: pointer;
}

.game-dialog.avatar-picker-dialog {
    width: min(620px, calc(100vw - 20px));
    max-width: 620px;
    max-height: min(88dvh, 760px);
    padding: 0;
    overflow: hidden;
}
.avatar-picker-dialog-layout {
    display: flex;
    flex-direction: column;
    height: min(88dvh, 760px);
    min-height: 0;
}
.avatar-picker-header {
    display: flex;
    flex: 0 0 auto;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 14px 10px;
    border-bottom: 1px solid rgba(217, 181, 104, 0.2);
}
.avatar-picker-header small { color: #87938f; font: 9px/1.3 Georgia, serif; letter-spacing: 0.14em; }
.game-dialog .avatar-picker-header h2 { margin: 2px 0 0; padding: 0; border: 0; font-size: 17px; }
.avatar-picker-x,
.auth-form .avatar-picker-x {
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    min-height: 42px;
    margin: 0;
    padding: 0;
    color: #d8dedb;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(210, 192, 151, 0.25);
    border-radius: 50%;
    font: 22px/1 sans-serif;
    cursor: pointer;
}
.avatar-picker-toolbar {
    display: grid;
    flex: 0 0 auto;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(149, 165, 160, 0.14);
}
.avatar-picker-toolbar label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.avatar-picker-toolbar input,
.auth-form .avatar-picker-toolbar input[type=search] {
    width: 100%;
    min-height: 42px;
    padding: 7px 10px;
    color: var(--text);
    background: #101719;
    border: 1px solid rgba(149, 165, 160, 0.3);
    border-radius: 9px;
    font: inherit;
    font-size: 16px;
}
.avatar-category-filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.avatar-category-filters button,
.auth-form .avatar-category-filters button {
    flex: 0 0 auto;
    min-height: 36px;
    margin: 0;
    padding: 5px 11px;
    color: #aeb8b4;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(149, 165, 160, 0.22);
    border-radius: 999px;
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}
.avatar-category-filters button[aria-pressed="true"] { color: #241b09; background: var(--accent); border-color: var(--accent); }
.avatar-picker-fieldset {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 10px 12px 14px;
    overflow-y: auto;
    border: 0;
    scrollbar-color: rgba(217, 181, 104, 0.4) transparent;
    scrollbar-width: thin;
}
.avatar-picker-fieldset > legend {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.avatar-picker-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.avatar-choice {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 4px;
    min-width: 0;
    min-height: 126px;
    padding: 8px 4px 9px;
    color: var(--text);
    text-align: center;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(149, 165, 160, 0.22);
    border-radius: 11px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.avatar-choice[hidden] { display: none; }
.avatar-choice input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-choice img { display: block; width: 82px; height: 82px; object-fit: contain; }
.avatar-choice strong { overflow-wrap: anywhere; color: #d9c998; font-size: 11px; line-height: 1.35; }
.avatar-choice-check {
    position: absolute;
    top: 6px;
    right: 6px;
    display: none;
    place-items: center;
    width: 22px;
    height: 22px;
    color: #241b09;
    background: var(--accent);
    border-radius: 50%;
    font-size: 13px;
    font-weight: bold;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.4);
}
.avatar-choice:has(input:checked) { border-color: var(--accent); background: rgba(217, 181, 104, 0.12); box-shadow: inset 0 0 0 1px rgba(217, 181, 104, 0.35); }
.avatar-choice:has(input:checked) .avatar-choice-check { display: grid; }
.avatar-choice:has(input:focus-visible) { outline: 2px solid #ffffff; outline-offset: -3px; }
.avatar-picker-empty { flex: 1 1 auto; margin: 0; padding: 24px 14px; color: var(--muted); text-align: center; }
.avatar-picker-footer {
    flex: 0 0 auto;
    display: grid;
    gap: 8px;
    padding: 9px 12px calc(10px + var(--safe-bottom));
    border-top: 1px solid rgba(217, 181, 104, 0.24);
    background: rgba(7, 15, 16, 0.96);
    box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.24);
}
.avatar-picker-selection { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 9px; align-items: center; min-width: 0; }
.avatar-picker-selection > img { display: block; width: 54px; height: 54px; object-fit: contain; }
.avatar-picker-selection > span { display: grid; gap: 1px; min-width: 0; }
.avatar-picker-actions { display: grid; grid-template-columns: minmax(90px, 0.65fr) minmax(0, 1.35fr); gap: 8px; }
.avatar-picker-actions .dialog-close,
.avatar-picker-actions .primary-button,
.auth-form .avatar-picker-actions .dialog-close,
.auth-form .avatar-picker-actions .primary-button { min-height: 46px; margin: 0; font-size: 13px; }
.auth-form .avatar-picker-actions .dialog-close {
    color: #d8dedb;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(210, 192, 151, 0.28);
    font-weight: 600;
}
.auth-form .avatar-picker-actions .primary-button {
    color: #201a0d;
    background: linear-gradient(180deg, #f0cf83, #c89f50);
    border: 0;
}

@media (max-width: 699px) {
    .game-dialog.avatar-picker-dialog {
        width: 100%;
        max-height: calc(100dvh - 10px - var(--safe-top));
    }
    .game-dialog.avatar-picker-dialog::before { content: none; display: none; }
    .avatar-picker-dialog-layout { height: calc(100dvh - 10px - var(--safe-top)); }
    .avatar-picker-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .avatar-choice { min-height: 116px; padding-inline: 2px; }
    .avatar-choice img { width: 74px; height: 74px; }
}

@media (max-width: 430px) {
    .avatar-current-card { grid-template-columns: 64px minmax(0, 1fr); }
    .avatar-current-image { width: 64px; height: 64px; }
    .avatar-picker-open { grid-column: 1 / -1; width: 100%; }
}

.celedia-dialog { max-width: 720px; max-height: 90dvh; overflow-y: auto; color: #e8f2f8; background: #0f2233; border: 1px solid #4f7f9c; }
.celedia-dialog::backdrop { background: #04101acc; }
.celedia-dialog h2 { color: #ffe9b0; }
.celedia-dialog .dark-story-line { font-size: 14px; line-height: 1.9; margin: 14px 0; }
.celedia-dialog .dark-eyebrow { color: #8fc2dc; }
.celedia-dialog button { display: block; min-height: 44px; width: 100%; margin-top: 18px; padding: 10px 16px; background: #1f5677; color: #fff2d5; border: 1px solid #6aa7c6; border-radius: 8px; }
.celedia-chart { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid #4f7f9c; margin: 12px 0; image-rendering: pixelated; }
