/*
 * 明亮新国风战役主题（2026-08）
 *
 * 木刻套印继续负责世界与人物，界面退成独立的轻绢信息层。战场、美术和
 * 数值不再互相争抢：桌面端保留完整横向舞台，窄屏把敌我拆成前后两列，
 * 顶栏改为底部短导航，避免所有控件一起压进画面上沿。
 */

:root {
  --paper: #fff8ec;
  --paper-dim: #f2e3ca;
  --ink: #252a31;
  --wood: #66503c;
  --wood-deep: #30241c;
  --zhu: #b8453d;
  --zhu-hi: #d45b48;
  --gold: #bd8b43;
  --gold-hi: #e0b86d;
  --qing: #357d77;
  --zhe: #8a5a36;
  --text-hi: #fff9eb;
  --text-de: #2c2a28;
  --silk: rgba(255, 250, 240, .91);
  --silk-strong: rgba(255, 252, 246, .975);
  --line: rgba(82, 69, 57, .22);
  --soft-shadow: 0 18px 48px rgba(37, 29, 24, .2);
}

html,
body {
  background: #e9dfcf;
  color: var(--ink);
}

button:focus-visible {
  outline: 3px solid rgba(205, 76, 64, .62);
  outline-offset: 2px;
}

.btn {
  border: 1px solid rgba(91, 68, 52, .36);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(255, 253, 247, .98), rgba(244, 231, 207, .96));
  box-shadow: 0 7px 18px rgba(54, 39, 29, .11), inset 0 1px rgba(255, 255, 255, .86);
}

.btn:hover {
  filter: brightness(1.025);
  border-color: rgba(184, 69, 61, .58);
  box-shadow: 0 10px 25px rgba(54, 39, 29, .15), inset 0 1px #fff;
}

.icon-badge {
  color: #fffaf0;
  border-color: rgba(255, 255, 255, .52);
  background: linear-gradient(145deg, #c85b48, #9e3735);
  box-shadow: 0 5px 12px rgba(100, 45, 38, .22);
}

.wood-frame,
.modal-panel,
.ending-panel {
  border: 1px solid rgba(82, 69, 57, .28);
  border-radius: 16px;
  background: linear-gradient(145deg, var(--silk-strong), rgba(240, 225, 201, .95));
  box-shadow: var(--soft-shadow), inset 0 1px rgba(255, 255, 255, .8);
  backdrop-filter: blur(14px) saturate(.9);
}

/* 顶栏是一条轻绢导航，不再是一根压住画面的黑木梁。 */
.topbar {
  height: 52px;
  gap: 8px;
  padding: 0 22px;
  border: 0;
  border-bottom: 1px solid rgba(113, 82, 57, .2);
  background: linear-gradient(90deg, rgba(255, 252, 244, .98), rgba(238, 244, 241, .96) 58%, rgba(255, 241, 232, .97));
  box-shadow: 0 9px 28px rgba(54, 42, 33, .13);
}

.topbar::before,
.topbar::after { display: none; }

.topbar-title {
  color: #3b3c3b;
  text-shadow: none;
  font-size: 16px;
  letter-spacing: 4px;
}

.topbar-sep { background: rgba(111, 85, 65, .18); }

.topbar-btn {
  min-height: 34px;
  color: #414244;
  text-shadow: none;
  border: 1px solid rgba(83, 77, 70, .18);
  border-radius: 9px;
  background: rgba(255, 253, 248, .72);
  box-shadow: 0 5px 14px rgba(58, 49, 42, .07);
}

.topbar-btn:hover,
.topbar-btn.open {
  color: #a83d3b;
  border-color: rgba(184, 69, 61, .42);
  background: rgba(255, 250, 242, .96);
}

.topbar-dropdown {
  top: 42px;
  border: 1px solid rgba(91, 68, 52, .28);
  border-radius: 12px;
  background: rgba(255, 250, 239, .98);
  box-shadow: var(--soft-shadow);
}

.topbar-dropdown .topbar-btn { color: #414244; }
.screen { inset: 52px 0 0; }
.overworld-root,
.treasure-root,
.battle-root,
.ending-root,
.story-bg { inset: 52px 0 0; }

/* 标题：把字放进稳定留白，不再让描边大字与山体争抢。 */
.title-screen {
  align-items: flex-start;
  justify-content: center;
  padding-left: clamp(36px, 8vw, 128px);
  background: #c9b59a;
}

.title-cover {
  background-position: center;
  filter: saturate(.94) contrast(.96) brightness(1.08);
}

.title-mask {
  background:
    linear-gradient(90deg, rgba(42, 31, 24, .64) 0%, rgba(42, 31, 24, .36) 38%, transparent 70%),
    linear-gradient(0deg, rgba(25, 17, 12, .2), transparent 52%);
}

.title-logo {
  align-self: flex-start;
  margin-top: clamp(120px, 24vh, 220px);
  text-align: left;
}

.title-logo h1 {
  max-width: 1100px;
  color: #fff8e9;
  font-size: clamp(44px, 4.5vw, 66px);
  letter-spacing: 9px;
  white-space: nowrap;
  text-shadow: 0 3px 22px rgba(34, 18, 11, .6);
}

.title-logo p {
  color: rgba(255, 246, 224, .88);
  letter-spacing: 5px;
  text-shadow: 0 2px 10px rgba(30, 18, 12, .68);
}

.title-menu {
  align-self: flex-start;
  margin-top: 4vh;
  gap: 10px;
}

.title-btn {
  width: 248px;
  padding: 11px 0;
  border: 1px solid rgba(255, 244, 222, .5);
  color: #3a312b;
  font-size: 18px;
  letter-spacing: 6px;
  background: rgba(255, 250, 237, .9);
  backdrop-filter: blur(10px);
}

/* 地图提示和剧情对白拥有自己的可读层，不再直接压暗整幅画。 */
.overworld-tip,
.overworld-loc,
.round-tag,
.field-rule {
  color: #393735;
  text-shadow: none;
  border: 1px solid rgba(88, 67, 52, .24);
  background: rgba(255, 250, 239, .9);
  box-shadow: 0 7px 20px rgba(42, 31, 24, .14);
  backdrop-filter: blur(10px);
}

.overworld-tip { top: 14px; max-width: min(720px, calc(100% - 32px)); }
.overworld-loc { bottom: 18px; }

.dlg-box {
  left: clamp(24px, 5vw, 72px);
  bottom: 26px;
  width: min(760px, calc(100% - 48px));
  min-height: 116px;
  transform: none;
  border: 1px solid rgba(82, 69, 57, .28);
  border-left: 5px solid rgba(184, 69, 61, .78);
  border-radius: 16px;
  background: linear-gradient(145deg, var(--silk-strong), rgba(246, 234, 214, .96));
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(15px) saturate(.9);
}

.dlg-portrait {
  width: 76px;
  height: 94px;
  border: 0;
  background: rgba(224, 210, 188, .55);
  box-shadow: none;
}

.dlg-name {
  color: #9f3938;
  text-shadow: none;
  border: 0;
  background: transparent;
  padding: 0;
  font-weight: bold;
}

.dlg-text { color: #333435; }

/* 战斗画面先读舞台，再读界面。 */
.battle-field {
  border: 0;
  background-position: center;
}

.battle-field::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 247, 231, .06), transparent 30%),
    linear-gradient(0deg, rgba(33, 27, 23, .17), transparent 34%);
}

.order-bar {
  top: 12px;
  left: 18px;
  right: auto;
  max-width: calc(100% - 300px);
  min-height: 42px;
  padding: 5px 10px;
  border: 1px solid rgba(82, 69, 57, .22);
  border-radius: 12px;
  background: rgba(255, 250, 239, .9);
  box-shadow: 0 8px 22px rgba(44, 34, 28, .14);
  backdrop-filter: blur(10px);
}

.order-label { color: #8f3c38; text-shadow: none; }
.order-chips { overflow-x: auto; scrollbar-width: none; }
.order-chips::before { background: linear-gradient(90deg, rgba(184, 69, 61, .52), rgba(189, 139, 67, .18)); }
.order-chip {
  flex: none;
  border-color: rgba(92, 74, 59, .2);
  background: rgba(255, 253, 247, .9);
}
.order-chip img { background: rgba(215, 201, 181, .52); border-color: rgba(92, 74, 59, .2); }
.order-chip-name { color: #3d3c3a; text-shadow: none; }
.order-chip-spd { color: #837568; }

.round-tag { top: 12px; right: 16px; }
.formation-btn { top: 55px; right: 16px; }
.field-rule {
  top: 94px;
  right: 16px;
  max-width: 260px;
  color: #9e4037;
}

.unit-card { width: 144px; z-index: 4; }
.unit-portrait {
  width: 118px;
  height: 154px;
  filter: drop-shadow(0 9px 8px rgba(31, 24, 20, .35));
}
.unit-card.big { width: 220px; }
.unit-card.big .unit-portrait { width: 196px; height: 238px; }
.unit-shadow { bottom: 70px; width: 88px; opacity: .72; }
.unit-card.big .unit-shadow { width: 156px; bottom: 70px; }

.unit-name {
  min-width: 92px;
  margin-top: -1px;
  color: #353332;
  text-shadow: none;
  text-align: center;
  border: 1px solid rgba(86, 66, 51, .24);
  border-radius: 8px;
  background: rgba(255, 250, 239, .93);
  box-shadow: 0 5px 14px rgba(38, 29, 24, .14);
}

.unit-bars { width: 118px; gap: 2px; }
.bar {
  height: 12px;
  border: 1px solid rgba(69, 52, 42, .52);
  background: rgba(42, 35, 31, .84);
}
.bar-text { line-height: 11px; font-size: 9px; }
.bar-cap { display: none; }
.buff-chip { color: #363433; text-shadow: none; border-color: rgba(99, 76, 57, .25); background: rgba(255, 249, 236, .94); }
.elem-badge { top: 8px; left: 9px; width: 27px; height: 27px; border-color: rgba(255,255,255,.72); }

.battle-bottom {
  height: 158px;
  gap: 10px;
  padding: 10px 14px;
  border: 0;
  border-top: 1px solid rgba(88, 69, 54, .2);
  background: linear-gradient(90deg, rgba(255, 252, 244, .985), rgba(238, 244, 241, .98) 60%, rgba(255, 243, 232, .985));
  box-shadow: 0 -12px 34px rgba(43, 34, 28, .15);
}

.cmd-status {
  width: 210px;
  padding: 7px 10px;
  border: 1px solid rgba(87, 67, 52, .22);
  border-radius: 12px;
  background: rgba(255, 253, 247, .78);
  box-shadow: 0 6px 16px rgba(48, 38, 31, .08);
}
.cmd-avatar { border: 0; background: rgba(220, 208, 190, .5); box-shadow: none; }
.cmd-btn { font-size: 17px; border-radius: 12px; }
.cmd-grid { gap: 8px; }
.wuxing-ring {
  margin-left: 0;
  color: #3e3c38;
  border-color: rgba(88, 68, 52, .22);
  background: rgba(255, 251, 242, .78);
  box-shadow: none;
}
.ring-arrow { color: #9e7160; }

.cmd-preview {
  left: 232px;
  bottom: 166px;
  color: #3c3a37;
  border: 1px solid rgba(184, 69, 61, .38);
  background: rgba(255, 251, 242, .96);
  box-shadow: var(--soft-shadow);
}
.pv-main { color: #33312f; }

/* 寻宝、结局同样使用轻绢容器，让背景保持是世界而不是遮罩底图。 */
.treasure-veil { background: linear-gradient(180deg, rgba(37,28,22,.16), rgba(37,28,22,.36)); }
.treasure-panel {
  border: 1px solid rgba(82, 69, 57, .28);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 252, 245, .975), rgba(240, 226, 201, .96));
  box-shadow: var(--soft-shadow);
}
.treasure-status { border: 0; border-radius: 10px; background: rgba(70, 57, 46, .9); }
.treasure-tile { border: 1px solid rgba(90, 69, 52, .34); border-radius: 12px; box-shadow: 0 7px 16px rgba(43, 31, 23, .15); }

.ending-root { background: #ccd7d4; }
.ending-bg { filter: saturate(.72) brightness(1.26) contrast(.94); }
.ending-panel { color: #343432; }

@media (max-width: 1360px) {
  .cmd-status { width: 188px; }
  .cmd-preview { left: 204px; }
  .wuxing-ring { padding-inline: 6px; }
  .order-bar { max-width: calc(100% - 260px); }
}

/* 窄屏不是桌面缩略图：导航下沉，战场敌我拆层，所有关键按钮保持可触。 */
@media (max-width: 700px) {
  .topbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    height: 60px;
    justify-content: space-around;
    padding: 6px 8px;
    border-top: 1px solid rgba(96, 75, 59, .2);
    border-bottom: 0;
    box-shadow: 0 -8px 26px rgba(50, 40, 33, .14);
  }

  .topbar-title,
  .topbar-sep,
  .topbar-spacer { display: none; }
  .topbar-group { flex: 1; justify-content: space-around; gap: 4px; }
  .topbar-btn {
    flex: 1;
    min-width: 0;
    min-height: 46px;
    flex-direction: column;
    gap: 1px;
    padding: 3px 4px;
    font-size: 10px;
    letter-spacing: 0;
  }
  .topbar-btn .icon-badge { width: 23px; height: 23px; font-size: 12px; }
  .topbar-sys { flex: 0 0 54px; }
  .topbar-dropdown { top: auto; right: 0; bottom: 54px; width: 150px; }

  body:not(.no-topbar) .screen,
  body:not(.no-topbar) .overworld-root,
  body:not(.no-topbar) .treasure-root,
  body:not(.no-topbar) .battle-root,
  body:not(.no-topbar) .ending-root,
  body:not(.no-topbar) .story-bg { inset: 0 0 60px; }

  .title-screen { padding: 0 20px; justify-content: flex-start; }
  .title-cover { background-position: 58% center; }
  .title-mask {
    background:
      linear-gradient(180deg, rgba(31,23,18,.16), rgba(31,23,18,.1) 38%, rgba(31,23,18,.54) 72%, rgba(31,23,18,.68)),
      linear-gradient(90deg, rgba(31,23,18,.25), transparent 75%);
  }
  .title-logo {
    align-self: stretch;
    margin-top: 13vh;
    text-align: center;
  }
  .title-logo h1 {
    max-width: 100%;
    font-size: clamp(38px, 11vw, 48px);
    line-height: 1.34;
    letter-spacing: 5px;
    white-space: normal;
  }
  .title-logo p { margin-top: 9px; font-size: 12px; line-height: 1.7; letter-spacing: 3px; }
  .title-menu { align-self: stretch; margin-top: auto; margin-bottom: 14vh; align-items: center; }
  .title-btn { width: min(280px, 82vw); padding: 11px 0; font-size: 17px; }

  .overworld-tip {
    top: 10px;
    width: calc(100% - 24px);
    max-width: none;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 1.45;
    text-align: center;
  }
  .overworld-loc { left: 10px; bottom: 10px; font-size: 12px; }

  .dlg-box {
    left: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
    min-height: 116px;
    gap: 9px;
    padding: 12px 13px;
    border-left-width: 4px;
  }
  .dlg-portrait { width: 56px; height: 74px; }
  .dlg-text { margin-top: 5px; font-size: 14px; line-height: 1.55; max-height: 88px; overflow: auto; }

  .battle-bottom {
    height: 246px;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: 68px 1fr;
    gap: 7px;
    padding: 8px 9px;
  }
  .cmd-status { grid-column: 1; width: auto; min-width: 0; padding: 5px 8px; }
  .cmd-avatar { width: 42px; height: 50px; }
  .cmd-who-name { font-size: 14px; }
  .cmd-who-tip { font-size: 10px; }
  .cmd-menu { grid-column: 1 / -1; grid-row: 2; min-height: 0; }
  .cmd-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .cmd-btn { min-height: 54px; font-size: 15px; letter-spacing: 2px; }
  .cmd-list { gap: 5px; }
  .cmd-item { flex: 1 1 46%; padding: 7px 9px; }
  .wuxing-ring {
    grid-column: 2;
    grid-row: 1;
    align-self: stretch;
    max-width: 170px;
    padding: 4px 6px;
    overflow: hidden;
  }
  .ring-el { width: 20px; height: 20px; font-size: 11px; }
  .ring-arrow { font-size: 9px; }

  .order-bar {
    top: 8px;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    min-height: 38px;
    padding: 4px 7px;
  }
  .order-label { font-size: 11px; letter-spacing: 1px; }
  .order-chip { padding-right: 4px; }
  .order-chip img { width: 22px; height: 22px; }
  .order-chip-name,
  .order-chip-spd { display: none; }
  .round-tag { top: 52px; right: 8px; font-size: 11px; }
  .formation-btn { top: 52px; left: 8px; right: auto; font-size: 11px; padding: 4px 8px; }
  .field-rule {
    top: 83px;
    right: 8px;
    left: 8px;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    text-align: center;
  }

  .unit-card { width: 88px; }
  .unit-portrait { width: 72px; height: 98px; }
  .unit-card.big { width: 118px; }
  .unit-card.big .unit-portrait { width: 106px; height: 136px; }
  .unit-name { min-width: 66px; max-width: 84px; padding: 1px 4px; font-size: 10px; letter-spacing: 0; }
  .unit-bars { width: 76px; margin-top: 2px; }
  .bar { height: 10px; }
  .bar-text { line-height: 9px; font-size: 7px; }
  .buff-chips { min-height: 12px; max-width: 82px; gap: 1px; }
  .buff-chip { font-size: 7px; padding: 0 2px; }
  .elem-badge { top: 4px; left: 5px; width: 22px; height: 22px; font-size: 11px; }
  .unit-shadow { bottom: 48px; width: 56px; }
  .unit-card.big .unit-shadow { bottom: 48px; width: 92px; }

  .cmd-preview {
    left: 10px;
    right: 10px;
    bottom: 252px;
    min-width: 0;
    max-width: none;
    font-size: 12px;
  }

  .modal-panel { width: calc(100% - 20px); max-height: calc(100% - 24px); padding: 18px 16px 14px; }
  .modal-title { font-size: 18px; letter-spacing: 3px; }
  .modal-foot { flex-wrap: wrap; }
  .modal-btn { flex: 1 1 40%; padding: 8px 12px; }

  .treasure-panel {
    width: calc(100% - 18px);
    height: calc(100% - 18px);
    min-height: 0;
    padding: 16px 12px;
    overflow: auto;
  }
  .treasure-head { display: block; }
  .treasure-title { font-size: 20px; letter-spacing: 3px; }
  .treasure-guide { margin-top: 4px; font-size: 12px; }
  .treasure-status { grid-template-columns: 1fr; gap: 5px; }
  .treasure-grid,
  .treasure-grid.deep { width: 100%; margin-top: 8px; grid-template-columns: repeat(2, 1fr); gap: 7px; }
  .treasure-tile { min-height: 92px; grid-template-columns: 32px 1fr; padding: 9px; }

  .ending-panel {
    width: calc(100% - 20px);
    max-height: calc(100% - 24px);
    overflow: auto;
    padding: 18px 16px;
  }
  .ending-panel p { font-size: 14px; line-height: 1.7; }
  .ending-title { font-size: 20px; letter-spacing: 3px; }
}

@media (max-height: 680px) and (min-width: 701px) {
  .battle-bottom { height: 142px; }
  .unit-portrait { height: 132px; }
  .unit-card.big .unit-portrait { height: 204px; }
}
