:root {
  --paper: #f6ecd6;
  --paper2: #efe1c0;
  --ink: #2b2118;
  --wood: #6b4a2a;
  --red: #a83a2c;
  --gold: #d9b44a;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: #2d4a24;
}
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* ================= 游戏页 ================= */
body.game { overflow: hidden; overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; }
#cv { position: fixed; inset: 0; width: 100vw; height: 100vh; image-rendering: pixelated; display: block; }

#vistaCv { position: fixed; inset: 0; width: 100vw; height: 100vh; image-rendering: pixelated; display: block; z-index: 3; animation: vistaIn 1.2s ease; }
@keyframes vistaIn { from { opacity: 0; } to { opacity: 1; } }
#vistaSound { position: fixed; top: max(8px, env(safe-area-inset-top)); right: 10px; z-index: 6; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(217, 180, 74, .6); background: rgba(30, 22, 14, .55); font-size: 18px; }
body.vista #stick, body.vista #prompt { display: none !important; }
body.vista #chatlog { bottom: auto; top: calc(52px + env(safe-area-inset-top, 0px)); }
body.vista #btnA { background: rgba(140, 70, 50, .75); }
#hud { position: fixed; top: max(8px, env(safe-area-inset-top)); left: 8px; display: flex; gap: 6px; align-items: center; z-index: 5; }
#hud > * { background: rgba(30, 22, 14, .7); color: #f6ecd6; border: 1px solid rgba(217, 180, 74, .5); border-radius: 14px; padding: 4px 10px; font-size: 13px; }
#meBtn { font-weight: bold; color: #a8f0a0; }

#netStatus { position: fixed; top: 48px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; padding: 6px 14px; border-radius: 14px; font-size: 13px; display: none; z-index: 30; }
#netStatus.show { display: block; }

#prompt { position: fixed; top: calc(52px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); background: rgba(30, 22, 14, .75); color: #ffe08a; padding: 4px 12px; border-radius: 12px; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#prompt.show { opacity: 1; }

#chatlog { position: fixed; left: 8px; bottom: calc(150px + var(--safe-b)); width: min(360px, 60vw); max-height: 30vh; overflow-y: auto; font-size: 13px; z-index: 4; pointer-events: none; scrollbar-width: none; }
#chatlog .line { background: rgba(20, 14, 8, .55); color: #f6ecd6; padding: 2px 8px; margin-top: 2px; border-radius: 6px; width: fit-content; max-width: 100%; word-break: break-all; transition: opacity 1s; }
#chatlog .line.old { opacity: 0; }
body.chatting #chatlog { pointer-events: auto; }
body.chatting #chatlog .line.old { opacity: .85; }
#chatlog .name { color: #ffe08a; }
#chatlog .tag { color: #9fd3ff; }
#chatlog .whisper .tag, #chatlog .whisper .name { color: #ffb3d1; }
#chatlog .sys { color: #b9e5a5; font-style: italic; }
#chatlog .hist { background: rgba(20, 14, 8, .4); color: #d9ccb4; }
#chatlog .hist .time { color: #a8977c; font-size: 11px; }

/* 摇杆与按钮 */
#stick { position: fixed; left: 24px; bottom: calc(24px + var(--safe-b)); width: 112px; height: 112px; border-radius: 50%; background: rgba(246, 236, 214, .16); border: 2px solid rgba(246, 236, 214, .35); display: none; z-index: 6; touch-action: none; }
#knob { position: absolute; left: 32px; top: 32px; width: 44px; height: 44px; border-radius: 50%; background: rgba(246, 236, 214, .55); border: 2px solid rgba(107, 74, 42, .6); pointer-events: none; }
body.touch #stick { display: block; }

#buttons { position: fixed; right: 16px; bottom: calc(24px + var(--safe-b)); display: flex; gap: 10px; align-items: flex-end; z-index: 6; }
#buttons button { width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--gold); background: rgba(43, 33, 24, .75); color: var(--paper); font-size: 20px; }
#buttons #btnA { width: 76px; height: 76px; font-size: 17px; font-weight: bold; background: rgba(168, 58, 44, .88); }
#buttons button:active { transform: scale(.94); }

#chatbar { position: fixed; left: 8px; right: 8px; bottom: calc(110px + var(--safe-b)); display: flex; gap: 6px; z-index: 20; }
#chatbar input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--wood); background: var(--paper); font-size: 16px; }
#chatbar button { border-radius: 10px; border: 2px solid var(--wood); background: var(--paper2); padding: 0 12px; white-space: nowrap; }
#chatbar #scopeBtn.whisper { background: #ffd6e5; }
body:not(.touch) #chatbar { bottom: 24px; right: auto; width: 520px; }

/* 面板 */
.panel { position: fixed; z-index: 15; background: var(--paper); border: 3px solid var(--wood); border-radius: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); padding: 10px; }
.panel .title { font-weight: bold; margin-bottom: 6px; color: var(--wood); }
.panel button { border: 2px solid var(--wood); background: var(--paper2); border-radius: 8px; padding: 8px 10px; }
#emotePanel { right: 16px; bottom: calc(110px + var(--safe-b)); display: grid; grid-template-columns: repeat(5, 44px); gap: 6px; }
#emotePanel button { font-size: 22px; padding: 4px; }
#menu { left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
#gamePanel { left: 50%; top: max(52px, env(safe-area-inset-top)); transform: translateX(-50%); min-width: 260px; max-width: 94vw; text-align: center; }
#gamePanel .msg { margin: 6px 0; }
#gamePanel .msg.big { font-size: 20px; font-weight: bold; color: var(--red); }
#gamePanel .msg.small { font-size: 12px; color: #6a5a48; }
#gamePanel .row { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
#gamePanel button.big { font-size: 18px; padding: 10px 24px; }

/* 对话框 */
#dialog { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); width: min(680px, calc(100vw - 16px)); z-index: 25; display: flex; gap: 10px; background: linear-gradient(var(--paper), var(--paper2)); border: 3px solid var(--wood); outline: 2px solid var(--gold); outline-offset: -7px; border-radius: 10px; padding: 14px 14px 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); }
#portrait { width: 64px; height: 64px; image-rendering: pixelated; background: #e3d2ac; border: 2px solid var(--wood); border-radius: 8px; flex: none; }
.dbody { flex: 1; min-width: 0; }
#dname { font-weight: bold; color: var(--red); margin-bottom: 4px; }
#dtext { min-height: 3.2em; line-height: 1.6; white-space: pre-wrap; font-size: 15px; }
#dmore { text-align: right; color: var(--wood); animation: blink 1s infinite; font-size: 12px; }
@keyframes blink { 50% { opacity: .2; } }
#dopts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
#dopts button { border: 2px solid var(--wood); background: #fff8e8; border-radius: 8px; padding: 6px 12px; }
#dopts button:hover { background: #ffe9b8; }
#dopts button.ai { border-color: #4a6fa5; color: #2c4c80; }
#aiForm { display: flex; gap: 6px; margin-top: 8px; }
#aiForm input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 2px solid var(--wood); font-size: 16px; }
#aiForm button { border: 2px solid var(--wood); background: var(--paper2); border-radius: 8px; padding: 0 14px; }
#dclose { position: absolute; right: 6px; top: 4px; border: none; background: none; font-size: 16px; color: var(--wood); }

/* 名帖 */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 30; display: flex; align-items: center; justify-content: center; }
.card { position: relative; display: flex; gap: 14px; background: var(--paper); border: 3px solid var(--wood); outline: 2px solid var(--gold); outline-offset: -7px; border-radius: 12px; padding: 18px; width: min(420px, 92vw); }
.card canvas { width: 64px; height: 96px; image-rendering: pixelated; background: #e3d2ac; border-radius: 8px; flex: none; }
.card .info { flex: 1; min-width: 0; }
.card h3 { margin: 0 0 4px; color: var(--red); }
.card .role { font-size: 13px; color: #6a5a48; margin-bottom: 8px; }
.card .stats { font-size: 13px; margin: 6px 0; }
.card .signText { font-style: italic; margin: 8px 0; }
.card form { display: flex; gap: 6px; margin-top: 8px; }
.card input { flex: 1; min-width: 0; padding: 6px 8px; border: 2px solid var(--wood); border-radius: 8px; font-size: 16px; }
.card button { border: 2px solid var(--wood); background: var(--paper2); border-radius: 8px; padding: 6px 10px; }
.card .x { position: absolute; right: 6px; top: 4px; border: none; background: none; }
.card .row { display: flex; gap: 6px; }

#toast { position: fixed; top: 18%; left: 50%; transform: translate(-50%, -10px); background: rgba(30, 22, 14, .88); color: #f6ecd6; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--gold); z-index: 40; opacity: 0; pointer-events: none; transition: all .25s; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ================= 普通页面（入村 / 管理 / 拒绝） ================= */
body.page { min-height: 100%; background: radial-gradient(circle at 50% 0, #3d6a30, #1f3518); padding: 24px 12px; }
.sheet { max-width: 760px; margin: 0 auto; background: var(--paper); border: 3px solid var(--wood); outline: 2px solid var(--gold); outline-offset: -8px; border-radius: 14px; padding: 28px 22px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.sheet h1 { margin: 0 0 4px; color: var(--red); font-family: serif; letter-spacing: 4px; text-align: center; }
.sheet .sub { text-align: center; color: #6a5a48; margin-bottom: 18px; }
.sheet label { display: block; font-weight: bold; margin: 14px 0 6px; }
.sheet input[type=text], .sheet input[type=password] { width: 100%; padding: 10px 12px; border: 2px solid var(--wood); border-radius: 8px; font-size: 16px; background: #fffaf0; }
.btn { display: inline-block; border: 2px solid var(--wood); background: var(--red); color: #fff; border-radius: 10px; padding: 10px 22px; font-size: 16px; text-decoration: none; }
.btn.alt { background: var(--paper2); color: var(--ink); }
.btn:disabled { opacity: .5; }
.err { color: var(--red); min-height: 1.4em; margin-top: 8px; }
.chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.chars .c { border: 2px solid #c9b48c; border-radius: 10px; padding: 10px; background: #fffaf0; cursor: pointer; text-align: center; }
.chars .c.on { border-color: var(--red); box-shadow: 0 0 0 2px var(--gold); background: #fff1da; }
.chars canvas { width: 48px; height: 72px; image-rendering: pixelated; }
.chars .t { font-weight: bold; }
.chars .d { font-size: 12px; color: #6a5a48; margin-top: 4px; }
.center { text-align: center; }

table.inv { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 14px; }
table.inv th, table.inv td { border-bottom: 1px solid #d9c9a5; padding: 8px 6px; text-align: left; vertical-align: middle; }
table.inv td button { border: 1px solid var(--wood); background: var(--paper2); border-radius: 6px; padding: 3px 8px; margin: 2px; font-size: 13px; }
.st-unused { color: #2c6e2c; } .st-bound { color: #2c4c80; } .st-revoked { color: #999; text-decoration: line-through; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3c3; margin-right: 4px; }
.qr { text-align: center; }
.qr img { width: 260px; height: 260px; image-rendering: pixelated; border: 1px solid #ccc; background: #fff; }
.qr .url { font-size: 12px; word-break: break-all; color: #6a5a48; margin: 6px 0 12px; }
@media print {
  body.page { background: #fff; padding: 0; }
  body.page > *:not(#qrModal) { display: none !important; }
  #qrModal { position: static; background: none; }
  #qrModal .noprint { display: none; }
}

/* ================= 游艺坊 FC 游戏机 ================= */
#arcade { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: radial-gradient(circle at 50% 30%, #3a2418, #120a08); color: var(--paper); padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ar-top { display: flex; align-items: center; gap: 6px; padding: 8px 10px; }
.ar-title { flex: 1; min-width: 0; font-weight: bold; color: #f2d48a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ar-btns { display: flex; gap: 6px; flex: none; }
.ar-top button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid rgba(217, 180, 74, .5); background: rgba(255, 240, 210, .08); color: var(--paper); font-size: 17px; flex: none; }
.ar-screen { flex: 1 1 auto; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 4px; }
#arCv { image-rendering: pixelated; image-rendering: crisp-edges; background: #000; box-shadow: 0 0 0 4px #4a2a1a, 0 0 0 6px #d9b44a, 0 10px 40px rgba(0, 0, 0, .6); }
#arMsg { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, .75); padding: 6px 14px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .3s; pointer-events: none; max-width: 90%; text-align: center; }
#arMsg.show { opacity: 1; }
#arLibPanel { position: absolute; inset: 8px; max-width: 560px; margin: auto; background: var(--paper); color: var(--ink); border: 3px solid var(--wood); outline: 2px solid var(--gold); outline-offset: -7px; border-radius: 12px; padding: 18px; overflow-y: auto; touch-action: pan-y; user-select: text; }
#arLibPanel h3 { margin: 0 0 12px; color: var(--red); text-align: center; }
#arLibPanel button { border: 2px solid var(--wood); background: var(--paper2); border-radius: 8px; padding: 8px 12px; font-size: 15px; color: var(--ink); }
#arLibPanel .ar-pick { display: block; width: 100%; background: var(--red); color: #fff; font-size: 16px; padding: 12px; margin-bottom: 12px; }
#arBack { display: block; width: 100%; margin-top: 10px; }
.ar-rom { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid #e0cfa8; }
.ar-rom span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-empty, .ar-note { font-size: 13px; color: #6a5a48; }
.ar-keys { text-align: center; font-size: 12px; color: #c9b48c; padding: 6px 10px 12px; }

/* 虚拟手柄：只在触屏设备显示 */
.ar-pad { display: none; }
body.touch .ar-keys { display: none; }
body.touch .ar-pad { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px 18px; gap: 10px; flex: none; }
.ar-dpad { position: relative; width: 150px; height: 150px; border-radius: 50%; background: rgba(255, 240, 210, .08); border: 2px solid rgba(217, 180, 74, .35); touch-action: none; flex: none; }
.ar-dpad::before, .ar-dpad::after { content: ''; position: absolute; background: #2a1c16; border: 2px solid #5a3a24; border-radius: 8px; }
.ar-dpad::before { left: 50px; top: 12px; width: 46px; height: 122px; }
.ar-dpad::after { top: 50px; left: 12px; height: 46px; width: 122px; }
.ar-dpad i { position: absolute; z-index: 1; font-style: normal; font-size: 16px; color: #c9b48c; pointer-events: none; transition: color .05s; }
.ar-dpad .u { left: 66px; top: 20px; } .ar-dpad .d { left: 66px; bottom: 20px; } .ar-dpad .l { left: 20px; top: 64px; } .ar-dpad .r { right: 20px; top: 64px; }
.ar-dpad[data-dir~="UP"] .u, .ar-dpad[data-dir~="DOWN"] .d, .ar-dpad[data-dir~="LEFT"] .l, .ar-dpad[data-dir~="RIGHT"] .r { color: #ffe08a; text-shadow: 0 0 8px #ffb347; }
.ar-mid { display: flex; gap: 10px; align-self: flex-end; margin-bottom: 8px; }
.ar-mid button { border-radius: 14px; border: 1px solid rgba(217, 180, 74, .5); background: #2a1c16; color: #c9b48c; font-size: 11px; padding: 7px 10px; letter-spacing: 1px; }
.ar-ab { position: relative; width: 160px; height: 130px; flex: none; }
.ar-ab button { position: absolute; width: 68px; height: 68px; border-radius: 50%; border: 3px solid #5a1a14; background: radial-gradient(circle at 35% 30%, #e0584a, #a8281e); color: #fff3dc; font-size: 22px; font-weight: bold; box-shadow: 0 4px 0 #4a120d; }
.ar-ab .b { left: 0; bottom: 6px; } .ar-ab .a { right: 0; top: 6px; }
.ar-pad button.on { transform: translateY(3px); box-shadow: 0 1px 0 #4a120d; filter: brightness(1.2); }
/* 横屏手机：画面居中占满高度，按钮都放在画面左右两侧的空白里，不压画面
   左：标题 / SELECT START / 十字键　　右：工具按钮 / A B */
@media (orientation: landscape) and (max-height: 520px) {
  body.touch #arcade {
    display: grid;
    grid-template-columns: minmax(164px, 1fr) minmax(0, calc((100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) * 256 / 240)) minmax(164px, 1fr);
    grid-template-rows: auto 1fr auto;
    grid-template-areas: "title screen btns" "mid screen ." "dpad screen ab";
  }
  body.touch .ar-top, body.touch .ar-pad { display: contents; }
  body.touch .ar-title { grid-area: title; padding: 10px 8px 0 12px; white-space: normal; overflow-wrap: anywhere; font-size: 15px; }
  body.touch .ar-btns { grid-area: btns; display: grid; grid-template-columns: repeat(3, 38px); gap: 6px; justify-self: end; padding: 8px 10px 0 0; }
  body.touch .ar-screen { grid-area: screen; padding: 4px 0; }
  body.touch .ar-mid { grid-area: mid; align-self: end; justify-self: center; margin: 0 0 6px; }
  body.touch .ar-dpad { grid-area: dpad; justify-self: center; margin: 0 0 12px 4px; }
  body.touch .ar-ab { grid-area: ab; justify-self: center; width: 150px; margin: 0 4px 12px 0; }
}
body.arcading #toast { z-index: 60; }
/* 竖屏手机：START/SELECT 单独一行，十字键和 AB 分居两侧 */
@media (orientation: portrait) {
  body.touch .ar-pad { flex-wrap: wrap; padding: 4px 14px 22px; row-gap: 4px; }
  body.touch .ar-mid { order: -1; width: 100%; justify-content: center; align-self: auto; margin: 0 0 4px; }
  .ar-ab { width: 150px; }
}
/* 菜园面板 */
#menu .info { font-size: 13px; line-height: 1.55; color: #5a4632; max-width: 250px; }
#menu .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#menu button:disabled { opacity: .45; }
/* 新手引导 */
#guide { position: fixed; top: calc(86px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); width: min(340px, calc(100vw - 24px)); background: rgba(30, 22, 14, .88); border: 2px solid var(--gold); border-radius: 12px; padding: 8px 12px 10px; color: var(--paper); z-index: 7; }
#guide .gtop { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #ffe08a; margin-bottom: 3px; }
#guideSkip { border: none; background: none; color: rgba(246, 236, 214, .6); font-size: 12px; padding: 2px 4px; }
#guideText { font-size: 15px; line-height: 1.45; }
body.vista #guide, body.chatting #guide { display: none; }
.pulse { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 214, 90, .9); } 50% { box-shadow: 0 0 0 12px rgba(255, 214, 90, 0); } }
/* 指路与地图 */
#navChip { color: #ffe08a !important; }
#adminBtn { text-decoration: none; }
.mapcard { position: relative; background: var(--paper); border: 3px solid var(--wood); outline: 2px solid var(--gold); outline-offset: -7px; border-radius: 12px; padding: 16px; width: min(640px, 94vw); max-height: 92vh; overflow-y: auto; }
.mapcard h3 { margin: 0 0 2px; color: var(--red); }
.maphint { font-size: 12px; color: #6a5a48; margin: 2px 0 8px; }
.mapbody { display: flex; gap: 12px; align-items: flex-start; }
.mapbody canvas { width: 240px; flex: none; border: 2px solid var(--wood); border-radius: 8px; cursor: pointer; }
.maplist { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.maplist button { border: 2px solid var(--wood); background: var(--paper2); border-radius: 8px; padding: 6px 8px; text-align: left; display: flex; flex-direction: column; }
.maplist button span { font-size: 11px; color: #6a5a48; }
.mapcard .x { position: absolute; right: 8px; top: 6px; border: none; background: none; font-size: 16px; }
@media (max-width: 560px) {
  .mapbody { flex-direction: column; align-items: center; }
  .mapbody canvas { width: min(200px, 60vw); }
  .maplist { width: 100%; grid-template-columns: 1fr 1fr 1fr; }
  .maplist button span { display: none; }
}
/* 常驻小地图：右上角，点开大地图 */
#minimap { position: fixed; top: max(8px, env(safe-area-inset-top)); right: 10px; width: 120px; aspect-ratio: 60 / 62; border: 2px solid var(--gold); border-radius: 8px; background: rgba(30, 22, 14, .7); box-shadow: 0 2px 6px rgba(0, 0, 0, .35); opacity: .92; cursor: pointer; z-index: 5; }
body.vista #minimap, body.arcading #minimap { display: none; }
@media (max-width: 560px), (max-height: 520px) { #minimap { width: 84px; } }
@media (max-width: 560px) { #guide { top: calc(104px + env(safe-area-inset-top, 0px)); } } /* 窄屏时引导框让开小地图 */

/* 白先生的书架 */
#reader { z-index: 40; }
.rcard { position: relative; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); border: 3px solid var(--wood); outline: 2px solid var(--gold); outline-offset: -7px; border-radius: 12px; padding: 14px 16px; width: min(680px, 96vw); height: min(92vh, 900px); height: min(92dvh, 900px); box-sizing: border-box; }
.rtop { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.rtop h3 { margin: 0; flex: 1; min-width: 0; color: var(--red); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rtop button { border: none; background: none; font-size: 15px; color: var(--wood); padding: 4px 6px; }
.rhint { color: #7a6a56; font-size: 14px; }
.rbook { display: flex; flex-direction: column; gap: 3px; text-align: left; width: 100%; margin: 8px 0; padding: 12px 14px; background: var(--paper2); border: 2px solid var(--wood); border-radius: 10px; color: var(--ink); }
.rbook b { font-size: 16px; color: var(--red); }
.rauthor { font-size: 13px; color: #6a5a48; }
.rintro { font-size: 14px; line-height: 1.6; }
.rprog { font-size: 13px; color: var(--wood); font-weight: bold; margin-top: 4px; }
.rnav { display: flex; gap: 6px; align-items: center; }
.rnav button, .rnav select { border: 2px solid var(--wood); background: var(--paper2); border-radius: 8px; padding: 5px 10px; font-size: 14px; color: var(--ink); }
.rnav select { flex: 1; min-width: 0; }
.rnav button:disabled { opacity: .4; }
.rmodes { display: flex; gap: 4px; margin: 8px 0 6px; }
.rmodes button { flex: 1; border: 1px solid var(--wood); background: transparent; border-radius: 14px; padding: 3px 0; font-size: 13px; color: var(--wood); }
.rmodes button.on { background: var(--wood); color: var(--paper); }
.rbody { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; user-select: text; -webkit-user-select: text; overscroll-behavior: contain; padding-right: 4px; }
.rlabel { font-size: 12px; font-weight: bold; color: var(--red); letter-spacing: 2px; margin: 14px 0 4px; }
.rorig { font-family: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif; font-size: 17px; line-height: 1.9; margin: 4px 0; text-indent: 2em; }
.rplain { font-size: 15px; line-height: 1.8; margin: 4px 0; text-indent: 2em; color: #3d3024; }
.rnotes { background: rgba(217, 180, 74, .16); border-left: 3px solid var(--gold); border-radius: 6px; padding: 2px 10px 6px; margin-top: 12px; }
.rnotes p { font-size: 14px; line-height: 1.7; margin: 4px 0; }
.rnotes .rlabel { margin-top: 8px; }
.rintro2 { background: var(--paper2); border-radius: 8px; padding: 6px 10px; font-size: 14px; line-height: 1.6; }
.rintro2 summary { font-weight: bold; color: var(--wood); }
.rintro2 p { margin: 6px 0; }
.rperson::before { content: "· "; }
.rend { text-align: center; color: var(--red); margin: 18px 0 6px; }
.rask, .rcomments { border-top: 1px dashed rgba(107, 74, 42, .4); margin-top: 14px; }
.ranswer { white-space: pre-wrap; font-size: 14px; line-height: 1.7; background: #fffaf0; border-radius: 8px; padding: 8px 10px; margin: 4px 0; }
.ranswer.err { color: #8a6a5a; }
.rform { display: flex; gap: 6px; margin: 6px 0 4px; }
.rform input { flex: 1; min-width: 0; padding: 7px 9px; border: 2px solid var(--wood); border-radius: 8px; font-size: 16px; background: #fffaf0; }
.rform button { border: 2px solid var(--wood); background: var(--paper2); border-radius: 8px; padding: 0 12px; font-size: 14px; }
.rform button:disabled { opacity: .5; }
.rnote { padding: 6px 0; border-bottom: 1px solid rgba(107, 74, 42, .15); }
.rnote b { font-size: 13px; color: var(--wood); }
.rnote p { margin: 3px 0 0; font-size: 14px; line-height: 1.6; word-break: break-word; }
.rtime { font-size: 12px; color: #9a8a76; margin-left: 8px; }
.rdel { float: right; border: none; background: none; font-size: 12px; color: #9a8a76; }
.rnext { display: block; width: 100%; margin: 16px 0 8px; padding: 10px; border: 2px solid var(--wood); background: var(--paper2); border-radius: 10px; font-size: 15px; color: var(--ink); }
