/* 绘卷重制主题 · 羊皮纸 / 黄铜 / 深色木框（覆盖旧像素主题） */
:root {
  /* Sites 设计参数：默认值与原绘卷主题一致，供外观/圆角/间距/字号/动效调节 */
  --site-bg: #10150d;
  --site-fg: #f4e5c4;
  --site-accent: #e5b968;
  --site-on-accent: #3a2410;
  --site-surface: #f8edd4;
  --site-muted: #9fb291;
  --site-border: #4a321c;
  --site-font: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --site-radius: 6px;
  --site-space: 1;
  --site-type: 1;
  --site-motion: 1;
  --ui: var(--site-font);
  --parchment: #f3e6c8;
  --ink: #33241c;
  --ink-soft: #5c4637;
  --gold: #e5b968;
  --gold-deep: #a9762f;
}
html, body { font-family: var(--ui); }
button, input, select { font-family: var(--ui); }
#game, .slot-icon, .book-card img, .detail-icon img { image-rendering: auto; }
img { image-rendering: auto; }

/* ---------- 战斗 HUD ---------- */
#combat-hud {
  position: absolute;
  top: calc(10px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, 96vw);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}
#combat-hud.solo {
  left: 50%;
  width: min(420px, calc(100vw - 24px));
}
#combat-hud.solo .combatant { flex: none; width: 100%; }
.combatant {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 6px 5px;
  color: #f5e9cd;
  background:
    linear-gradient(180deg, rgba(45, 30, 22, 0.82), rgba(27, 18, 14, 0.86));
  border: 1px solid rgba(229, 185, 104, 0.6);
  border-radius: 40px 6px 6px 40px;
  box-shadow: 0 4px 16px rgba(10, 6, 4, 0.4), inset 0 0 0 1px rgba(255, 240, 200, 0.06);
  backdrop-filter: blur(6px);
}
.combatant.rival-side {
  flex-direction: row;
  padding: 5px 5px 6px 12px;
  border-radius: 6px 40px 40px 6px;
  background:
    linear-gradient(180deg, rgba(54, 27, 20, 0.84), rgba(30, 15, 12, 0.88));
}
.portrait-frame {
  flex: none;
  width: 54px; height: 54px;
  border-radius: 50%;
  padding: 2px;
  background: radial-gradient(circle at 35% 25%, #f3d493, #9a6a2c 62%, #4a2f14);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), inset 0 0 0 1px #ffe9b5;
  overflow: hidden;
}
.portrait-frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  filter: saturate(1.05);
}
.rival-side .portrait-frame { background: radial-gradient(circle at 35% 25%, #f0bc86, #a5562f 60%, #4a2114); }
.combatant-plate { flex: 1; min-width: 0; }
.combatant-name {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; letter-spacing: 2px;
  color: #ffe9bd;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
.small-chip {
  font-size: 9px; letter-spacing: 1px;
  color: #efd79b;
  border: 1px solid rgba(229, 185, 104, 0.45);
  border-radius: 8px;
  padding: 0 5px;
  background: rgba(0,0,0,.18);
}
.health-bar {
  position: relative;
  height: 12px;
  margin: 3px 0 2px;
  background: linear-gradient(180deg, #1b120d, #2c1e15);
  border: 1px solid rgba(229, 185, 104, 0.55);
  border-radius: 6px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.6);
  overflow: hidden;
}
.health-bar i {
  display: block; height: 100%; width: 100%;
  border-radius: 5px;
  background: linear-gradient(180deg, #a8da81, #5da757 55%, #3a7c3d);
  box-shadow: 0 0 8px rgba(140, 210, 110, 0.35);
  transition: width .2s ease;
}
.health-bar.rival i { background: linear-gradient(180deg, #e89a6c, #c25436 55%, #8c2f1f); box-shadow: 0 0 8px rgba(220, 110, 70, 0.35); }
.health-bar.low i { background: linear-gradient(180deg, #f0b06c, #d05f3a 55%, #8e2a1f); animation: lowPulse 1s ease-in-out infinite; }
@keyframes lowPulse { 50% { filter: brightness(1.35); } }
.combatant-foot {
  display: flex; align-items: baseline; gap: 9px;
  font-size: 9px; color: #d9c6a4;
  white-space: nowrap;
  overflow: hidden;
}
.combatant-foot > span:first-child { color: #fff0c8; font-size: 11px; min-width: 22px; }
.stat-inline b { color: var(--gold); font-weight: normal; }
.combatant-foot .fps { margin-left: auto; color: #a9c895; font-size: 9px; }

/* 回合徽章 */
.round-medallion {
  flex: none;
  display: flex; align-items: center; gap: 0;
  margin-top: 1px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.45));
}
.medallion-face {
  width: 96px; height: 70px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #ffe9bd;
  background:
    radial-gradient(ellipse at 50% 22%, rgba(255, 224, 160, 0.18), transparent 60%),
    linear-gradient(180deg, #4b3220, #2a1a10);
  border: 2px solid #c99a4e;
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px rgba(255, 226, 160, 0.18), inset 0 0 18px rgba(0,0,0,.55);
}
.round-label { font-size: 9px; letter-spacing: 2px; color: #eacd92; }
.round-score {
  display: flex; align-items: baseline; gap: 5px;
  font-size: 23px; line-height: 1.1;
  color: #fff1c9;
  font-variant-numeric: tabular-nums;
}
.round-score i { font-style: normal; font-size: 14px; color: #b78c4a; }
.round-sub { font-size: 8px; letter-spacing: 1px; color: #b79a6b; }
.medallion-wing {
  width: 18px; height: 2px;
  background: linear-gradient(90deg, transparent, #c99a4e);
}
.medallion-wing.right { background: linear-gradient(90deg, #c99a4e, transparent); }

/* 回合横幅 */
#duel-banner {
  position: absolute;
  left: 50%; top: calc(96px + var(--safe-t));
  transform: translateX(-50%);
  min-width: 300px;
  padding: 10px 46px;
  text-align: center;
  color: #33200f;
  background:
    linear-gradient(180deg, #f8e8bd, #e4c583 60%, #d6b06a);
  border-top: 2px solid #fff2cd;
  border-bottom: 2px solid #8f6427;
  box-shadow: 0 6px 24px rgba(0,0,0,.35), inset 0 0 22px rgba(140, 92, 28, 0.22);
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 14px 100%, 0 50%);
  animation: bannerIn .35s ease-out;
}
#duel-banner b {
  display: block;
  font-size: 20px;
  letter-spacing: 5px;
  font-weight: normal;
}
#duel-banner span { display: block; font-size: 10px; letter-spacing: 2px; color: #6f4c20; }
@keyframes bannerIn { from { opacity: 0; transform: translate(-50%, -8px) scale(.96); } }

/* 旧版左上角只保留小品牌 */
.hud-brand {
  position: absolute;
  top: calc(10px + var(--safe-t));
  left: calc(14px + var(--safe-l));
  font-size: 13px;
  letter-spacing: 2px;
  opacity: .92;
}
.hud-brand .brand-mark { color: #f3cd82; }
.hud-brand .chip { font-size: 9px; }

#hud-top-right .icon-btn {
  background: linear-gradient(180deg, rgba(48, 33, 22, 0.82), rgba(28, 19, 13, 0.86));
  border: 1px solid rgba(229, 185, 104, 0.42);
  box-shadow: 0 3px 0 rgba(12, 8, 4, 0.5);
  border-radius: 4px;
}
#hud-top-right .icon-btn:hover { border-color: #e5b968; background: linear-gradient(180deg, rgba(72, 50, 30, 0.9), rgba(40, 27, 17, 0.9)); }
.icon-btn .glyph { color: #f0c880; }
.icon-btn .ib-label { color: #dbc7a2; }

/* ---------- 法术栏 ---------- */
#spellbar {
  gap: 3px;
  padding: 6px 8px;
  background:
    linear-gradient(180deg, rgba(56, 37, 23, 0.86), rgba(28, 18, 11, 0.92));
  border: 1px solid rgba(229, 185, 104, 0.5);
  border-radius: 6px;
  box-shadow: 0 8px 26px rgba(8, 4, 2, 0.45), inset 0 0 0 1px rgba(255, 232, 180, 0.08);
}
.spell-slot {
  width: 58px; height: 60px;
  background: rgba(20, 13, 8, 0.55);
  border: 1px solid rgba(229, 185, 104, 0.18);
  border-radius: 3px;
}
.spell-slot:hover { background: rgba(63, 42, 24, 0.72); border-color: rgba(229, 185, 104, 0.6); }
.spell-slot .slot-icon { width: 32px; height: 32px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.55)); }
.spell-slot .slot-name { font-size: 9px; color: #dccaa6; letter-spacing: .5px; }
.spell-slot .slot-key { color: #a98a5c; font-size: 8px; }
.spell-slot.active {
  border-color: #f0c877;
  background: linear-gradient(180deg, rgba(96, 66, 34, 0.82), rgba(46, 30, 17, 0.88));
  box-shadow: 0 0 0 1px rgba(255, 225, 160, 0.25), 0 0 16px rgba(232, 180, 92, 0.28);
}
#quick-help {
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(44, 30, 20, 0.82), rgba(26, 17, 11, 0.86));
  border-color: rgba(229, 185, 104, 0.35);
  color: #e7d6b4;
}
.qh-title { color: #f0c877; letter-spacing: 1px; }
.qh-grid { color: #d9c8a6; }
.qh-grid b { color: #fff0cf; }
.qh-tip { color: #bca47e; border-color: rgba(229, 185, 104, 0.18); }

/* ---------- 标题 ---------- */
#screen-title .title-scrim {
  background:
    linear-gradient(90deg, rgba(24, 18, 12, 0.9) 0%, rgba(26, 20, 13, 0.68) 36%, rgba(26, 20, 13, 0.16) 72%, transparent 100%),
    linear-gradient(0deg, rgba(16, 12, 8, 0.6), transparent 44%),
    radial-gradient(ellipse at 74% 42%, rgba(243, 205, 130, 0.14), transparent 55%);
}
.title-content { width: min(600px, 90vw); }
.title-kicker { letter-spacing: 5px; color: var(--site-accent); }
.game-logo {
  font-family: var(--ui);
  font-weight: 600;
  color: var(--site-fg);
  text-shadow: 0 2px 0 rgba(88, 54, 20, 0.8), 0 8px 26px rgba(255, 196, 96, 0.18);
}
.game-logo.big { letter-spacing: 12px; }
.title-desc { font-size: 13px; line-height: 2.1; color: #e8d7b6; }
.title-menu { width: min(340px, 100%); gap: calc(7px * var(--site-space, 1)); }
.menu-btn {
  padding: calc(8px * var(--site-space, 1)) calc(16px * var(--site-space, 1));
  border: 1px solid color-mix(in srgb, var(--site-accent) 35%, transparent);
  border-radius: var(--site-radius);
  background: linear-gradient(180deg, rgba(52, 36, 23, 0.78), rgba(29, 20, 13, 0.82));
  box-shadow: 0 4px 14px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255, 232, 180, 0.05);
  color: var(--site-fg);
  letter-spacing: 2px;
}
.menu-btn small { color: #bda986; letter-spacing: .5px; }
.menu-btn:hover {
  border-color: var(--site-accent);
  background: linear-gradient(180deg, rgba(76, 54, 31, 0.86), rgba(41, 28, 17, 0.88));
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,.32), 0 0 16px rgba(232, 180, 92, 0.14);
}
.menu-btn.primary {
  color: var(--site-on-accent);
  background: linear-gradient(180deg, #f8e2ac, #e2ba70 58%, #d0a45c);
  border-color: #fff0c8;
  box-shadow: 0 4px 0 rgba(122, 78, 28, 0.55), 0 8px 22px rgba(0,0,0,.3);
  text-shadow: 0 1px 0 rgba(255, 248, 224, 0.65);
}
.menu-btn.primary small { color: #5a3a10; font-weight: 600; }
.menu-btn.primary:hover { background: linear-gradient(180deg, #ffedbd, #ecc77c 58%, #d9ad61); }
.menu-btn.subtle { background: rgba(30, 21, 14, 0.45); color: #c9b694; }

.title-figures {
  position: absolute;
  right: max(4vw, 20px);
  bottom: 9vh;
  display: flex;
  align-items: flex-end;
  gap: 18px;
  z-index: 3;
  pointer-events: none;
}
.title-figures .figure {
  position: relative;
  width: clamp(120px, 13vw, 190px);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 5px;
  background: radial-gradient(circle at 35% 25%, #f6dda2, #b07c34 58%, #573a18);
  box-shadow: 0 14px 40px rgba(0,0,0,.5), inset 0 0 0 2px #ffe8b0;
  transform: rotate(-3deg);
}
.title-figures .figure.rival { width: clamp(104px, 11vw, 160px); transform: rotate(4deg) translateY(18px); }
.title-figures .figure img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.title-figures .figure span {
  position: absolute; left: 50%; bottom: -22px; transform: translateX(-50%);
  font-size: 10px; letter-spacing: 3px; color: #f0d79c;
  white-space: nowrap;
  text-shadow: 0 2px 6px rgba(0,0,0,.8);
}
.title-credit { color: rgba(235, 216, 178, 0.45); font-size: 9px; }

/* ---------- 加载 ---------- */
#screen-loading {
  background:
    radial-gradient(ellipse at 50% 36%, rgba(120, 150, 88, 0.28), transparent 58%),
    radial-gradient(ellipse at 50% 110%, #29351f, var(--site-bg) 72%);
}
.loading-bar { border-radius: 6px; }
.loading-bar i { background: linear-gradient(90deg, #9c7740, #f3cd82); }
.loading-text, .loading-tip { letter-spacing: .5px; }

/* ---------- 弹窗 / 法术书 ---------- */
.modal-panel {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 248, 222, 0.9), transparent 50%),
    linear-gradient(180deg, var(--site-surface), color-mix(in srgb, var(--site-surface) 82%, #a07a3f));
  border: 2px solid var(--site-border);
  border-radius: var(--site-radius);
  box-shadow: 0 0 0 3px #caa76b, 0 0 0 6px #3b2817, 0 30px 70px rgba(4, 3, 2, 0.6);
  color: var(--ink);
}
.panel-head { border-bottom: 1px solid rgba(74, 50, 28, 0.25); }
.panel-head h2 { font-weight: 600; letter-spacing: 5px; }
.close-btn {
  background: var(--site-border); color: #f6e7c4;
  border: 2px solid #2b1d10; box-shadow: 2px 2px 0 #b9905a; border-radius: calc(var(--site-radius) / 2);
}
.close-btn:hover { background: #a45a3a; }
.settings-tabs button.active { background: var(--site-border); color: #f8e8c2; border-color: #2b1d10; box-shadow: 2px 2px 0 #b9905a; }
.mode-card { border-radius: var(--site-radius); }
.mode-card:has(input:checked) { box-shadow: 2px 2px 0 #b9905a; }
input[type="range"]::-webkit-slider-thumb { border-radius: 50%; }
select { border-radius: calc(var(--site-radius) / 2); background: #fff7e6; }

#screen-spellbook {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(74, 52, 30, 0.4), transparent 72%),
    rgba(16, 12, 8, 0.8);
}
.book-wrap {
  background:
    linear-gradient(90deg, transparent 49.4%, rgba(96, 64, 30, 0.32) 49.6%, rgba(96, 64, 30, 0.32) 50.4%, transparent 50.6%),
    radial-gradient(ellipse at 50% 0%, rgba(255, 250, 232, 0.9), transparent 60%),
    linear-gradient(180deg, #f8ecd0, #ead6ac);
  border: 2px solid #4a321c;
  border-radius: 6px 12px 12px 6px;
  box-shadow: 0 0 0 4px #caa76b, 0 0 0 7px #3b2817, 0 36px 80px rgba(3, 2, 1, 0.65);
}
.book-head h2 { font-weight: 600; letter-spacing: 8px; }
.book-grid { gap: 7px; }
.book-card {
  background: rgba(255, 250, 236, 0.55);
  border: 1px solid rgba(74, 50, 28, 0.22);
  border-radius: 4px;
}
.book-card:hover { border-color: #8a632f; background: #fff8e8; }
.book-card.active { border-color: #8a632f; background: #fff8e8; box-shadow: 3px 3px 0 #c2a26a; }
.book-card img { filter: drop-shadow(0 2px 2px rgba(0,0,0,.18)); }
.book-detail { border-left: 1px solid rgba(74, 50, 28, 0.22); }
.detail-icon { border-radius: 50%; border-color: rgba(74, 50, 28, 0.28); }
.detail-desc { color: #4a3928; }
.detail-tip { background: rgba(197, 158, 92, 0.16); border-left-color: #b98a43; color: #65503a; }
#btn-book-equip { background: #4a321c; border-color: #2b1d10; color: #f8e8c2; }
#btn-book-equip:hover { background: #7c5127; }

/* 决斗说明 */
.help-duel { margin: 14px 0 0; padding-top: 10px; border-top: 1px dashed rgba(58, 46, 56, 0.25); }
.help-duel h3 { font-size: 15px; margin: 0 0 6px; letter-spacing: 1px; }

/* 响应式 */
@media (min-width: 1181px) {
  #combat-hud { left: calc(50% - 85px); width: min(860px, calc(100vw - 510px)); }
}
@media (max-width: 1180px) {
  #combat-hud { top: calc(64px + var(--safe-t)); width: min(880px, 97vw); }
  #duel-banner { top: calc(146px + var(--safe-t)); }
  .combatant { padding: 4px 10px 5px 4px; }
  .portrait-frame { width: 46px; height: 46px; }
  .round-medallion { transform: scale(.88); }
}
@media (max-width: 760px) {
  #combat-hud { width: 98vw; gap: 4px; top: calc(58px + var(--safe-t)); }
  .combatant { gap: 5px; border-radius: 26px 4px 4px 26px; }
  .combatant.rival-side { border-radius: 4px 26px 26px 4px; }
  .portrait-frame { width: 38px; height: 38px; }
  .combatant-name { font-size: 10px; letter-spacing: 1px; }
  .combatant-foot { font-size: 8px; gap: 5px; }
  .combatant-foot .stat-inline { display: none; }
  .medallion-face { width: 72px; height: 56px; }
  .round-score { font-size: 18px; }
  .round-label, .round-sub { font-size: 7px; }
  .medallion-wing { width: 8px; }
  .title-figures { opacity: .55; right: 4px; }
  .title-figures .figure { width: 90px; }
  .title-figures .figure.rival { width: 74px; }
  #duel-banner { top: calc(118px + var(--safe-t)); min-width: 240px; padding: 8px 30px; }
  #duel-banner b { font-size: 16px; letter-spacing: 3px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .title-content {
    width: min(820px, 96vw);
    padding-left: max(4vw, 16px);
    padding-top: calc(8px + var(--safe-t));
    padding-bottom: calc(8px + var(--safe-b));
    column-gap: 22px;
  }
  .game-logo.big { font-size: clamp(34px, 11vh, 48px); letter-spacing: 5px; }
  .title-kicker { font-size: 10px; letter-spacing: 3px; }
  .title-desc, .title-foot, .title-figures { display: none; }
  .title-menu { width: 100%; gap: 4px; }
  .title-menu .menu-btn { min-height: 38px; padding: 4px 12px; font-size: 13px; }
  .title-menu .menu-btn small { display: none; }
}
@media (max-width: 600px) {
  #hud-top-right { gap: 3px; }
  .icon-btn { min-width: 34px; width: 34px; height: 38px; padding: 2px; }
  .icon-btn .ib-label, .icon-btn .keycap { display: none; }
  .icon-btn .ic { font-size: 15px; }
  .hud-brand .chip { display: none; }
  .title-figures { display: none; }
  .combatant-foot .fps { display: none; }
}
@media (max-height: 520px) {
  .hud-brand { display: none; }
  #combat-hud { top: calc(8px + var(--safe-t)); left: calc(50% - 70px); width: min(660px, calc(100vw - 280px)); }
  #hud-top-right [data-action="help"], #hud-top-right [data-action="settings"] { display: none; }
  .icon-btn { min-width: 36px; width: 36px; height: 36px; padding: 2px; }
  .icon-btn .ib-label, .icon-btn .keycap { display: none; }
  .portrait-frame { width: 36px; height: 36px; }
  .combatant { padding-top: 3px; padding-bottom: 3px; }
  .combatant-foot .stat-inline { display: none; }
  .round-medallion { transform: scale(.78); }
  #duel-banner { top: calc(88px + var(--safe-t)); }
  #toasts { top: calc(166px + var(--safe-t)); }
}