/*
 * Okey v1 Formation Room UI system
 * Layout and interaction stay in the existing feature styles. This layer owns
 * typography, shared material tokens, reusable components, and surface mood.
 */

@font-face {
  font-family: "Okey Cinzel";
  src: url(lib/fonts/v1/cinzel-latin-600.woff2) format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0000-024F, U+1E00-1EFF;
}

@font-face {
  font-family: "Okey Cinzel";
  src: url(lib/fonts/v1/cinzel-latin-700.woff2) format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0000-024F, U+1E00-1EFF;
}

@font-face {
  font-family: "Okey Noto Serif SC";
  src: url(lib/fonts/v1/noto-serif-sc-latin-600.woff2) format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0000-024F, U+1E00-1EFF;
}

@font-face {
  font-family: "Okey Noto Serif SC";
  src: url(lib/fonts/v1/noto-serif-sc-latin-700.woff2) format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0000-024F, U+1E00-1EFF;
}

@font-face {
  font-family: "Okey Noto Serif SC";
  src: url(lib/fonts/v1/noto-serif-sc-600.woff2) format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  unicode-range: U+2E80-2EFF, U+3000-303F, U+31C0-31EF, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FE10-FE1F, U+FE30-FE4F, U+FF00-FFEF;
}

@font-face {
  font-family: "Okey Noto Serif SC";
  src: url(lib/fonts/v1/noto-serif-sc-700.woff2) format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  unicode-range: U+2E80-2EFF, U+3000-303F, U+31C0-31EF, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FE10-FE1F, U+FE30-FE4F, U+FF00-FFEF;
}

@font-face {
  font-family: "Okey Nav Slab";
  src: url(lib/fonts/zilla-slab-700-latin.woff2) format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --okey-font-display: "Okey Cinzel", "Okey Noto Serif SC", "Songti SC", serif;
  --okey-font-ui: "Okey Cinzel", "Okey Noto Serif SC", "Songti SC", "STSong", serif;
  --okey-font-data: "Outfit", system-ui, sans-serif;

  --okey-v1-ink: #080d0b;
  --okey-v1-ink-soft: #111914;
  --okey-v1-emerald-950: #071b15;
  --okey-v1-emerald-900: #0b2b21;
  --okey-v1-emerald-800: #123d30;
  --okey-v1-emerald-700: #1b5540;
  --okey-v1-emerald-500: #398263;
  --okey-v1-wood-950: #1b0e09;
  --okey-v1-wood-800: #3a2116;
  --okey-v1-wood-650: #5a3824;
  --okey-v1-stone: #5c5d50;
  --okey-v1-gold-hi: #f4dda0;
  --okey-v1-gold: #c8a45e;
  --okey-v1-gold-deep: #765027;
  --okey-v1-parchment: #f3e8c8;
  --okey-v1-muted: #c8bfa4;
  --okey-v1-danger: #8e2632;
  --okey-v1-info: #315f70;

  --okey-v1-art-button-primary: url(assets/ui-skin/ui-button-green-v1.webp?v=1);
  --okey-v1-art-button-danger: url(assets/ui-skin/ui-button-red-v1.webp?v=1);
  --okey-v1-art-button-info: url(assets/ui-skin/ui-button-blue-v1.webp?v=1);
  --okey-v1-art-panel: url(assets/ui-skin/ui-panel-frame-v1.webp?v=1);
  --okey-v1-art-hud: url(assets/ui-skin/ui-hud-strip-v1.webp?v=1);
  --okey-v1-art-ground: url(assets/ui-skin/ui-battle-hub-bg-v1.webp?v=1);
  --okey-v1-art-tech-dawn-chamber: url(assets/tech-ui/tech-dawn-chamber-bg-v1.webp?v=1);
  --okey-v1-art-tech-node-unlocked: url(assets/tech-ui/tech-node-frame-unlocked-v1.webp?v=1);
  --okey-v1-art-tech-node-locked: url(assets/tech-ui/tech-node-frame-locked-v1.webp?v=1);
  --okey-v1-art-tech-detail-panel: url(assets/tech-ui/tech-detail-panel-frame-v1.webp?v=1);
  --okey-v1-art-tech-era-tab: url(assets/tech-ui/tech-era-tab-frame-v1.webp?v=1);
  --okey-v1-art-tech-bottom-nav: url(assets/tech-ui/tech-bottom-nav-button-frame-v1.webp?v=1);
  --okey-v1-art-tech-topbar-pill: url(assets/tech-ui/tech-topbar-pill-frame-v1.webp?v=1);
  --okey-v1-art-tech-round-button: url(assets/tech-ui/tech-round-icon-button-frame-v1.webp?v=1);

  --okey-v1-shadow-panel: 0 18px 42px rgba(0, 0, 0, 0.58), inset 0 1px rgba(255, 244, 199, 0.08);
  --okey-v1-shadow-control: 0 5px 0 rgba(21, 12, 8, 0.82), 0 10px 18px rgba(0, 0, 0, 0.34);
  --okey-v1-focus: 0 0 0 3px rgba(244, 221, 160, 0.42), 0 0 20px rgba(200, 164, 94, 0.36);
  --font-family: var(--okey-font-ui);
}

html,
body,
button,
input,
select,
textarea {
  font-family: var(--okey-font-ui) !important;
}

body {
  color: var(--okey-v1-parchment);
  background: var(--okey-v1-ink);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

input,
select,
textarea,
[data-okey-ui-role="field"],
.bb-card-stats,
.battle-codex-detail-stats,
.battle-metric-card,
.settings-version {
  font-family: var(--okey-font-data) !important;
  font-variant-numeric: tabular-nums;
}

h1,
h2,
h3:where(:not(.battle-profile-subheading)),
.logo,
.lobby-logo,
.page-title,
[data-okey-ui="title"] {
  font-family: var(--okey-font-display) !important;
  font-weight: 700;
  letter-spacing: 0.025em;
  color: var(--okey-v1-gold-hi) !important;
  text-shadow: 0 2px 0 #25160d, 0 4px 10px rgba(0, 0, 0, 0.72) !important;
}

:lang(zh) h1,
:lang(zh) h2,
:lang(zh) h3,
:lang(zh) .page-title,
:lang(zh) [data-okey-ui="title"] {
  letter-spacing: 0.08em;
}

button:focus-visible:not(.age1-onboarding-map-target),
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--okey-v1-gold-hi) !important;
  outline-offset: 2px;
  box-shadow: var(--okey-v1-focus) !important;
}

/* Reusable components ---------------------------------------------------- */

[data-okey-ui="panel"],
.okey-v1-panel {
  position: relative;
  border: clamp(10px, 2.2cqw, 18px) solid transparent !important;
  border-image-source: var(--okey-v1-art-panel) !important;
  border-image-slice: 190 !important;
  border-image-width: clamp(10px, 2.2cqw, 18px) !important;
  border-image-outset: 3px !important;
  border-image-repeat: stretch !important;
  border-radius: 18px !important;
  background:
    radial-gradient(circle at 50% 0%, rgba(244, 221, 160, 0.07), transparent 34%),
    linear-gradient(180deg, rgba(18, 61, 48, 0.98), rgba(7, 27, 21, 0.985)) !important;
  background-clip: padding-box !important;
  box-shadow: var(--okey-v1-shadow-panel) !important;
  color: var(--okey-v1-parchment);
}

body .okey-button[data-okey-ui="button"][data-okey-variant]:not([data-okey-button="off"]),
[data-okey-ui="button"]:not([data-okey-button="off"]):not(.bb-catalog-card):not(.battle-tech-tree-node):not(.battle-level-node),
.okey-v1-button {
  --ui-button-skin: var(--okey-v1-art-button-primary);
  border-color: transparent !important;
  background-color: var(--okey-v1-emerald-900) !important;
  background-image: var(--ui-button-skin) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  box-shadow: var(--okey-v1-shadow-control) !important;
  color: #fff !important;
  font-weight: 700;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.88) !important;
}

#battle-barracks-panel #battle-barracks-training-card .bb-training-action {
  color: #4a1d08 !important;
  text-shadow: 0 1px 0 rgba(255, 248, 200, 0.8) !important;
}

body .okey-button[data-okey-ui="button"][data-okey-variant="danger"]:not([data-okey-button="off"]),
[data-okey-ui="button"][data-okey-variant="danger"],
[data-okey-ui="button"][data-okey-button-variant="danger"],
.battle-outcome-card:not(.is-defeat) .battle-outcome-back-btn,
.battle-strike-btn,
.reset-btn {
  --ui-button-skin: var(--okey-v1-art-button-danger) !important;
  background-image: var(--okey-danger-button-image, var(--okey-v1-art-button-danger)) !important;
}

[data-okey-ui="button"][data-okey-variant="icon"],
[data-okey-ui="button"][data-okey-variant="nav"],
[data-okey-ui="button"][data-okey-button-variant="icon"],
[data-okey-ui="button"][data-okey-button-variant="nav"] {
  filter: saturate(0.82) brightness(0.93);
}

[data-okey-ui="button"][data-okey-state~="active"],
[data-okey-ui="button"][data-okey-state~="selected"],
[data-okey-ui-role="tab"][data-okey-state~="active"] {
  filter: brightness(1.13) saturate(1.05);
  box-shadow: 0 3px 0 rgba(21, 12, 8, 0.9), var(--okey-v1-focus) !important;
}

[data-okey-ui="button"][data-okey-state~="disabled"],
[data-okey-ui="button"][data-okey-state~="locked"],
[data-okey-ui="card"][data-okey-state~="locked"] {
  filter: grayscale(0.72) brightness(0.62) !important;
  opacity: 0.68;
}

[data-okey-ui="hud"],
.okey-v1-hud {
  border-color: transparent !important;
  background-color: var(--okey-v1-wood-950) !important;
  background-image: var(--okey-v1-art-hud) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.48) !important;
}

[data-okey-ui="resource"]:not(.hub-frame):not(.map-home-wallet .bm-pill):not(.commerce-has-store-link),
[data-okey-ui="card"],
[data-okey-ui="inset"],
.okey-v1-inset {
  border: 1px solid rgba(200, 164, 94, 0.5) !important;
  background-color: var(--okey-v1-emerald-900) !important;
  background-image:
    linear-gradient(rgba(7, 27, 21, 0.24), rgba(7, 27, 21, 0.52)),
    var(--okey-v1-art-button-primary) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  color: var(--okey-v1-parchment) !important;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.32), inset 0 1px rgba(255, 255, 255, 0.09) !important;
}

[data-okey-ui-role="badge"] {
  border: 1px solid var(--okey-v1-gold) !important;
  background: linear-gradient(180deg, #825b2a, #3b2515) !important;
  color: #fff !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.42), inset 0 1px rgba(255, 255, 255, 0.22) !important;
}

[data-okey-ui-role="field"],
.custom-options-list {
  border: 1px solid rgba(200, 164, 94, 0.72) !important;
  background: linear-gradient(180deg, rgba(16, 47, 37, 0.98), rgba(6, 24, 18, 0.99)) !important;
  color: var(--okey-v1-parchment) !important;
}

/* Player surfaces ------------------------------------------------------- */

.home-screen-content.lobby {
  background-color: #071b15 !important;
  background-image:
    radial-gradient(circle at 50% 42%, rgba(13, 66, 48, 0.04), rgba(3, 18, 13, 0.36) 74%, rgba(2, 10, 8, 0.66)),
    linear-gradient(180deg, rgba(7, 35, 27, 0.12), rgba(4, 20, 15, 0.48)),
    url(assets/lobby-main-bg.jpg) !important;
  background-blend-mode: multiply, normal, normal;
}

@container okey-stage (max-width: 520px) {
  .home-screen-content.lobby {
    background-image:
      radial-gradient(circle at 50% 42%, rgba(13, 66, 48, 0.02), rgba(3, 18, 13, 0.28) 74%, rgba(2, 10, 8, 0.62)),
      linear-gradient(180deg, rgba(7, 35, 27, 0.08), rgba(4, 20, 15, 0.44)),
      url(assets/lobby-main-bg-mobile.jpg) !important;
  }
}

.home-screen-content.lobby .lobby-play-btn,
.home-screen-content.lobby .lobby-continue-btn,
.home-screen-content.lobby .res-plus,
.home-screen-content.lobby .lobby-gear,
.home-screen-content.lobby .rail-icon,
.home-screen-content.lobby .nav-tab,
.home-screen-content.lobby .lobby-avatar-block {
  --ui-button-skin: var(--okey-v1-art-button-primary) !important;
  background-color: var(--okey-v1-emerald-900) !important;
  background-image: var(--okey-v1-art-button-primary) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  border-color: transparent !important;
}

.home-screen-content.lobby .lobby-play-btn {
  min-height: 66px;
  font-family: var(--okey-font-display) !important;
  font-size: clamp(1.05rem, 4.6cqw, 1.45rem);
  letter-spacing: 0.06em;
}

.home-screen-content.lobby .res-pill {
  border: 1px solid var(--okey-v1-gold) !important;
  color: var(--okey-v1-parchment) !important;
  background: linear-gradient(180deg, rgba(32, 71, 55, 0.97), rgba(8, 32, 24, 0.98)) !important;
}

#page-store {
  background:
    radial-gradient(circle at 50% 0%, rgba(200, 164, 94, 0.15), transparent 38%),
    linear-gradient(180deg, rgba(7, 27, 21, 0.84), rgba(4, 16, 12, 0.96));
  border-top: 1px solid rgba(200, 164, 94, 0.34);
}

.page-store-inner {
  width: min(100%, 1180px);
  margin-inline: auto;
  padding-inline: clamp(12px, 3cqw, 34px);
}

.store-section-title,
.daily-checkin-kicker,
.battle-codex-kicker,
.blp-kicker {
  color: var(--okey-v1-gold-hi) !important;
  font-family: var(--okey-font-display) !important;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.78);
}

.battle-map-content {
  --battle-theme-velvet: var(--okey-v1-emerald-900);
  --battle-theme-wine: var(--okey-v1-emerald-800);
  --battle-theme-ink: var(--okey-v1-ink-soft);
  --battle-theme-gold: var(--okey-v1-gold-hi);
  background-color: var(--okey-v1-emerald-900) !important;
  background-image:
    radial-gradient(circle at 50% 45%, transparent 25%, rgba(4, 17, 13, 0.28) 100%),
    var(--okey-v1-art-ground) !important;
}

.battle-barracks-panel {
  background: #21170f !important;
}

.battle-codex-panel {
  background:
    linear-gradient(180deg, rgba(5, 26, 19, 0.74), rgba(3, 15, 11, 0.9)),
    var(--okey-v1-art-ground) center / cover no-repeat !important;
}

.battle-tech-panel {
  background-color: #0a0907 !important;
  background-image:
    linear-gradient(180deg, rgba(3, 9, 8, 0.2), rgba(3, 8, 7, 0.1) 62%, rgba(3, 8, 7, 0.72)),
    var(--okey-v1-art-tech-dawn-chamber) !important;
  background-position: center top !important;
  background-repeat: no-repeat !important;
  background-size: 100% auto !important;
}

.bb-catalog-toolbar,
.battle-codex-header,
.battle-tech-detail-meta span,
.battle-codex-preview-panel,
.setting-item,
.daily-checkin-streak,
.daily-checkin-day,
.battle-level-preview-body,
.battle-outcome-card:not(.is-defeat) .battle-outcome-body {
  border-color: rgba(200, 164, 94, 0.48) !important;
  background-color: var(--okey-v1-emerald-900) !important;
  background-image:
    linear-gradient(rgba(5, 24, 18, 0.18), rgba(5, 24, 18, 0.42)),
    var(--okey-v1-art-button-primary) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
}

.battle-tech-tree-map {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
}

.battle-tech-page-board .battle-tech-tree-node {
  width: 88px;
  height: 88px;
  background: var(--okey-v1-art-tech-node-unlocked) center / contain no-repeat !important;
  filter: grayscale(0.72) brightness(0.58) drop-shadow(0 4px 5px rgba(0, 0, 0, 0.64));
}

.battle-tech-page-board .battle-tech-tree-node.branch-root,
.battle-tech-page-board .battle-tech-tree-node.branch-trunk,
.battle-tech-page-board .battle-tech-tree-node.branch-crown {
  width: 94px;
  height: 94px;
}

.battle-tech-page-board .battle-tech-tree-node.ready {
  filter: saturate(0.9) brightness(0.9) drop-shadow(0 0 8px rgba(255, 214, 94, 0.58));
}

.battle-tech-page-board .battle-tech-tree-node.unlocked {
  filter: saturate(1.04) brightness(1.04) drop-shadow(0 0 9px rgba(255, 205, 67, 0.82));
}

.battle-tech-page-board .battle-tech-tree-node[data-tech-status="locked"] {
  background-image: var(--okey-v1-art-tech-node-locked) !important;
  filter: brightness(0.7) saturate(0.62) drop-shadow(0 5px 5px rgba(0, 0, 0, 0.72));
}

.battle-tech-page-board .battle-tech-tree-node[data-tech-status="locked"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 21%;
  width: 13%;
  height: 11%;
  transform: translateX(-50%);
  border: 2px solid #c49a51;
  border-radius: 2px;
  background: #21170f;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.78), inset 0 0 0 1px rgba(255, 226, 147, 0.16);
}

.battle-tech-page-board .battle-tech-tree-node[data-tech-status="locked"]::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 31%;
  width: 11%;
  height: 10%;
  transform: translateX(-50%);
  border: 2px solid #c49a51;
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
}

.battle-tech-page-board .battle-tech-tree-node .tech-node-icon {
  position: absolute;
  top: 11%;
  left: 22%;
  width: 56%;
  height: 56%;
  overflow: hidden;
  border-radius: 50%;
}

.battle-tech-page-board .battle-tech-tree-node .battle-tech-icon-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.battle-tech-page-board .battle-tech-tree-node[data-tech-status="locked"] .tech-node-icon {
  top: 19%;
  left: 31%;
  width: 38%;
  height: 38%;
  opacity: 0.48;
}

.battle-tech-page-board .battle-tech-tree-node .tech-node-title {
  position: absolute;
  left: 13%;
  bottom: 8%;
  width: 74%;
  height: 18%;
  display: -webkit-box;
  overflow: hidden;
  color: #fff6cf;
  font-family: var(--okey-font-ui);
  font-size: 0.58rem;
  font-weight: 900;
  line-height: 1.03;
  text-align: center;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.92);
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.battle-tech-page-board .battle-tech-tree-node[data-tech-status="locked"] .tech-node-title {
  display: none;
}

.battle-tech-detail-modal {
  place-items: end center !important;
  padding: 10px !important;
}

.battle-tech-detail-card {
  width: min(100%, 680px) !important;
  max-height: min(82cqh, 620px);
  gap: 10px !important;
  overflow-y: auto;
  padding: 16px 18px 18px !important;
  border: 30px solid transparent !important;
  border-image-source: var(--okey-v1-art-tech-detail-panel) !important;
  border-image-slice: 70 90 70 90 fill !important;
  border-image-width: 30px !important;
  border-image-outset: 0 !important;
  border-image-repeat: stretch !important;
  border-radius: 0 !important;
  background: #071d16 !important;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.72) !important;
  scrollbar-width: thin;
  transform: translateY(16px) scale(0.97) !important;
}

.battle-tech-detail-modal.visible .battle-tech-detail-card {
  transform: translateY(0) scale(1) !important;
}

.battle-tech-detail-card > .battle-tech-detail-close {
  top: 20px !important;
  right: 20px !important;
}

.battle-tech-page-tabs {
  width: min(100%, 720px) !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 4px !important;
}

.battle-tech-page-tab {
  min-width: 0;
  min-height: 58px !important;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 4px !important;
  border: 14px solid transparent !important;
  border-image-source: var(--okey-v1-art-tech-era-tab) !important;
  border-image-slice: 50 68 50 68 fill !important;
  border-image-width: 14px !important;
  border-image-outset: 0 !important;
  border-image-repeat: stretch !important;
  border-radius: 0 !important;
  background: #06261c !important;
  color: #f7e7b5 !important;
  box-shadow: none !important;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.9) !important;
}

.battle-tech-page-tab.active {
  filter: brightness(1.14) saturate(1.08) drop-shadow(0 0 7px rgba(255, 201, 62, 0.88));
  color: #fff4c7 !important;
}

.battle-tech-page-tab.locked {
  filter: grayscale(0.82) brightness(0.56);
}

.battle-tech-page-tab b {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--okey-font-ui);
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
}

.battle-tech-era-glyph {
  position: relative;
  width: 17px;
  height: 17px;
  display: block;
  color: #e8bc55;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.78));
}

.battle-tech-era-glyph::before,
.battle-tech-era-glyph::after {
  content: "";
  position: absolute;
  inset: 2px;
  background: currentColor;
}

.battle-tech-era-glyph[data-tech-era="tribal"]::before {
  border-radius: 50%;
  box-shadow: 0 -5px 0 -3px currentColor, 0 5px 0 -3px currentColor, -5px 0 0 -3px currentColor, 5px 0 0 -3px currentColor;
}

.battle-tech-era-glyph[data-tech-era="magic"]::before {
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.battle-tech-era-glyph[data-tech-era="gunpowder"]::before {
  inset: 5px 2px 2px;
  box-shadow: 4px -4px 0 -1px currentColor, 8px -7px 0 -2px currentColor;
}

.battle-tech-era-glyph[data-tech-era="modern"]::before {
  inset: 7px 0;
  transform: rotate(38deg);
}

.battle-tech-era-glyph[data-tech-era="modern"]::after {
  inset: 7px 0;
  transform: rotate(-38deg);
}

.battle-tech-era-glyph[data-tech-era="future"]::before {
  inset: 0;
  clip-path: polygon(50% 0, 61% 35%, 100% 35%, 69% 57%, 80% 100%, 50% 72%, 20% 100%, 31% 57%, 0 35%, 39% 35%);
}

.battle-tech-era-head {
  display: none;
}

@container okey-stage (max-width: 560px) {
  .battle-tech-page-tab {
    min-height: 54px !important;
    grid-template-columns: 1fr;
    gap: 2px;
    border-width: 11px !important;
    border-image-width: 11px !important;
    padding: 3px 1px !important;
  }

  .battle-tech-page-tab b {
    font-size: 0.5rem;
  }

  .battle-tech-era-glyph {
    width: 14px;
    height: 14px;
    margin: 0 auto;
  }
}

@container okey-stage (min-width: 700px) {
  .battle-tech-detail-card {
    grid-template-columns: minmax(0, 1fr) 180px;
  }

  .battle-tech-detail-head,
.battle-tech-detail-meta {
    grid-column: 1;
  }

  .battle-tech-buy-btn {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: stretch;
  }
}

@container okey-stage (max-width: 560px) {
  .battle-tech-page-board .battle-tech-tree-node {
    width: 82px;
    height: 82px;
  }

  .battle-tech-page-board .battle-tech-tree-node.branch-root,
.battle-tech-page-board .battle-tech-tree-node.branch-trunk,
.battle-tech-page-board .battle-tech-tree-node.branch-crown {
    width: 88px;
    height: 88px;
  }

  .battle-tech-page-board .battle-tech-tree-node .tech-node-title {
    font-size: 0.52rem;
  }
}

.battle-map-tab.active,
.battle-tech-page-tab.active,
.battle-codex-tab.active,
.bb-catalog-route-filter button.active {
  --ui-button-skin: var(--okey-v1-art-button-primary) !important;
  background-image: var(--okey-v1-art-button-primary) !important;
  color: #fff !important;
}

.battle-tech-reset {
  background-image: var(--okey-v1-art-button-danger) !important;
}

.modal-overlay,
.okey-game-modal-overlay {
  background: var(
    --okey-modal-overlay-background,
    radial-gradient(circle at 50% 42%, rgba(28, 78, 58, 0.18), transparent 42%),
    rgba(2, 9, 7, 0.88)
  ) !important;
  backdrop-filter: var(--okey-modal-overlay-filter, blur(5px) saturate(0.8)) !important;
}

.okey-game-modal-close,
.battle-codex-detail-close,
.battle-tech-detail-close {
  border: var(--okey-modal-close-border, 1px solid var(--okey-v1-gold)) !important;
  background: var(--okey-modal-close-background, linear-gradient(180deg, #53301f, #24130d)) !important;
  color: var(--okey-modal-close-color, #fff) !important;
  font-family: var(--okey-font-data) !important;
}

.daily-checkin-day.today,
.battle-age-option.active,
.bb-catalog-card.equipped {
  box-shadow: var(--okey-v1-focus), 0 8px 20px rgba(0, 0, 0, 0.36) !important;
}

body.in-match .game-container {
  background:
    linear-gradient(180deg, rgba(4, 25, 18, 0.34), rgba(3, 14, 11, 0.52)),
    var(--okey-match-classic-table-mobile) center / cover no-repeat,
    var(--okey-v1-emerald-900) !important;
}

body.in-match .game-container::before {
  background:
    radial-gradient(circle at 50% 45%, rgba(244, 221, 160, 0.09), transparent 36%),
    linear-gradient(180deg, rgba(5, 31, 23, 0.08), rgba(3, 14, 11, 0.34)) !important;
}

body.in-match .game-header,
body.in-match .player-area {
  background-image: var(--okey-v1-art-hud) !important;
}

body[data-mode="battle"] #battle-arena {
  background-color: var(--okey-v1-emerald-900) !important;
  background-image:
    linear-gradient(rgba(5, 26, 19, 0.22), rgba(4, 17, 13, 0.5)),
    var(--okey-v1-art-ground) !important;
  border-image-source: var(--okey-v1-art-panel) !important;
}

body[data-mode="battle"] .status-bar,
body[data-mode="battle"] .lane-castle,
body[data-mode="battle"] .battle-supply-items-rail,
body[data-mode="battle"] .battle-tech-active-rail {
  background-image: var(--okey-v1-art-button-primary) !important;
}

.banner-alert,
.interactive-toast {
  background-color: var(--okey-v1-emerald-900) !important;
  background-image: var(--okey-v1-art-button-primary) !important;
  border-color: var(--okey-v1-gold) !important;
}

/* Responsive contract --------------------------------------------------- */

@container okey-stage (max-width: 520px) {
  .okey-portrait-stage > * {
    --okey-v1-shadow-panel: 0 12px 28px rgba(0, 0, 0, 0.52), inset 0 1px rgba(255, 244, 199, 0.08);
    font-size: 14px;
  }

  .modal-card:not(.developer-code-card) {
    width: var(--okey-modal-card-mobile-width, min(94cqw, 430px)) !important;
    max-height: var(--okey-modal-card-mobile-max-height, calc(100cqh - 24px)) !important;
    padding: var(--okey-modal-card-mobile-padding, 14px) !important;
  }

  .home-screen-content.lobby .lobby-topbar {
    min-height: 58px;
  }

  .home-screen-content.lobby .lobby-play-btn {
    min-width: min(270px, 72cqw);
  }

  .battle-map-content,
.home-screen-content.lobby,
.game-container {
    max-width: 100cqw;
    overflow-x: hidden;
  }
}

/* Mobile-first daily supply page. ImageGen art stays in independent layers so
   live text, reward state, localization, and touch controls remain DOM-driven. */
#modal-daily-checkin {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100cqh !important;
  padding: 0 !important;
  align-items: stretch !important;
  overflow: hidden !important;
  background: #2d5d2d !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

#modal-daily-checkin .daily-checkin-card {
  position: relative;
  isolation: isolate;
  width: min(100%, 480px) !important;
  max-width: 480px !important;
  min-height: 100cqh;
  max-height: 100cqh !important;
  margin: 0 auto;
  padding:
    max(16px, var(--okey-safe-top))
    14px
    max(14px, var(--okey-safe-bottom)) !important;
  display: block !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  border: 0 !important;
  border-radius: 0 !important;
  background-color: #84c83a !important;
  background-image:
    linear-gradient(180deg, rgba(255, 248, 197, 0.05) 0%, rgba(255, 248, 197, 0) 44%, rgba(81, 47, 17, 0.08) 68%, rgba(55, 30, 12, 0.42) 100%),
    url(assets/daily-checkin/camp-bg-mobile-v2.webp?v=2) !important;
  background-position: center top !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
  box-shadow: 0 0 42px rgba(36, 22, 8, 0.72) !important;
  color: #4b2b15;
  image-rendering: pixelated;
}

#modal-daily-checkin .daily-checkin-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(48, 28, 10, 0.18), transparent 14%, transparent 86%, rgba(48, 28, 10, 0.18)),
    linear-gradient(180deg, transparent 0 56%, rgba(255, 224, 137, 0.08) 70%, rgba(62, 32, 12, 0.32) 100%);
}

#modal-daily-checkin .daily-checkin-close {
  position: absolute !important;
  z-index: 10;
  top: max(14px, var(--okey-safe-top)) !important;
  right: 14px !important;
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  padding: 0 !important;
  display: grid !important;
  place-items: center;
  border: 3px solid #f5d171 !important;
  border-radius: 5px !important;
  background: linear-gradient(180deg, #76502d 0%, #4b2d19 52%, #2a170d 100%) !important;
  box-shadow:
    inset 0 0 0 2px #1b100a,
    inset 0 3px rgba(255, 234, 158, 0.2),
    0 4px 0 #2c160a,
    0 7px 12px rgba(51, 25, 8, 0.42) !important;
  color: #fff0ae !important;
  font: 900 29px/1 var(--okey-font-data) !important;
  text-shadow: 0 2px #2a1509;
}

#modal-daily-checkin .daily-checkin-close:focus-visible,
#modal-daily-checkin .daily-checkin-claim:focus-visible {
  outline: 3px solid #fff8cf !important;
  outline-offset: 3px;
}

#modal-daily-checkin .daily-checkin-header {
  position: relative;
  z-index: 4;
  margin-right: 52px;
  padding: 10px 12px 11px;
  border: 3px solid #673211;
  border-radius: 5px;
  background:
    linear-gradient(90deg, rgba(124, 69, 25, 0.11) 1px, transparent 1px) 0 0 / 18px 100%,
    linear-gradient(180deg, #ffe9ad 0%, #f7ce7c 58%, #dda052 100%);
  box-shadow:
    inset 0 0 0 2px #fff0bd,
    inset 0 -7px rgba(132, 67, 20, 0.13),
    0 5px 0 #4c260f,
    0 9px 18px rgba(72, 39, 13, 0.32);
  text-shadow: 0 1px rgba(255, 249, 211, 0.72);
}

#modal-daily-checkin .daily-checkin-header::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px dashed rgba(112, 58, 18, 0.42);
  pointer-events: none;
}

#modal-daily-checkin .daily-checkin-kicker {
  position: relative;
  display: inline-flex;
  width: auto;
  margin: 0 0 3px;
  padding: 3px 9px;
  border: 2px solid #385d20;
  border-radius: 3px;
  background: linear-gradient(180deg, #7fc443, #4f8e2e);
  color: #fff7c8 !important;
  font-size: 0.66rem;
  line-height: 1.2;
  text-shadow: 0 1px #2d541d;
}

#modal-daily-checkin .daily-checkin-header h2 {
  position: relative;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  color: #6a2f10 !important;
  font-family: var(--okey-font-display) !important;
  font-size: clamp(1.85rem, 9cqw, 2.75rem) !important;
  line-height: 1 !important;
  letter-spacing: -0.02em;
  text-shadow: 0 2px #fff0b4;
}

html:lang(en) #modal-daily-checkin .daily-checkin-header h2 {
  font-size: clamp(1.55rem, 7.8cqw, 2.35rem) !important;
}

#modal-daily-checkin .daily-checkin-subtitle {
  position: relative;
  max-width: 330px;
  margin: 6px 0 8px !important;
  color: #5c371b !important;
  font-size: 0.75rem !important;
  font-weight: 800;
  line-height: 1.32 !important;
}

#modal-daily-checkin .daily-checkin-streak {
  position: relative;
  width: fit-content;
  min-width: 154px;
  margin: 0;
  padding: 6px 12px;
  border: 2px solid #e6b74f !important;
  border-radius: 3px !important;
  background-color: #4b2b17 !important;
  background-image: linear-gradient(180deg, #654124, #382014) !important;
  box-shadow: inset 0 0 0 2px #27160d, 0 3px 0 #6a3512 !important;
  color: #fff0a6;
  font-size: 0.75rem;
  text-align: center;
  text-shadow: 0 1px #211108;
}

#modal-daily-checkin .daily-checkin-scene {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

#modal-daily-checkin .daily-checkin-guide {
  position: absolute;
  top: clamp(218px, 27cqh, 278px);
  left: -12%;
  width: 71%;
  height: auto;
  filter: drop-shadow(0 8px 0 rgba(64, 36, 13, 0.42)) drop-shadow(0 12px 10px rgba(56, 31, 10, 0.3));
  transform-origin: left bottom;
  image-rendering: pixelated;
}

#modal-daily-checkin .daily-checkin-stage {
  position: relative;
  z-index: 3;
  min-height: 300px;
  margin-top: clamp(104px, 16cqh, 148px);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

#modal-daily-checkin .daily-checkin-grid {
  position: relative;
  z-index: 2;
  width: 72%;
  margin-left: auto;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  grid-auto-flow: dense;
  grid-auto-rows: 72px;
  gap: 6px !important;
}

#modal-daily-checkin .daily-checkin-day {
  position: relative;
  min-width: 0;
  min-height: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  isolation: isolate;
  border: 3px solid #6b3514 !important;
  border-radius: 4px 4px 8px 8px !important;
  background-color: #edbd69 !important;
  background-image:
    linear-gradient(90deg, rgba(132, 70, 21, 0.12) 1px, transparent 1px),
    linear-gradient(180deg, #ffe4a1 0%, #efbd68 68%, #c87c35 100%) !important;
  background-size: 13px 100%, auto !important;
  box-shadow:
    inset 0 0 0 2px #fff0bd,
    inset 0 -6px rgba(107, 49, 16, 0.17),
    0 4px 0 #4b260f,
    0 7px 10px rgba(70, 37, 12, 0.3) !important;
  clip-path: polygon(0 0, 100% 0, 100% 88%, 50% 100%, 0 88%);
}

#modal-daily-checkin .daily-checkin-day.today {
  order: -1;
  grid-column: span 2;
  grid-row: span 3;
  border-color: #ffe077 !important;
  background-color: #1e78b6 !important;
  background-image:
    radial-gradient(circle at 50% 78%, rgba(91, 218, 255, 0.54), transparent 48%),
    linear-gradient(180deg, #2e9fe1 0%, #1768ad 54%, #173d7b 100%) !important;
  background-size: auto !important;
  box-shadow:
    inset 0 0 0 3px #7adfff,
    inset 0 -9px rgba(8, 36, 95, 0.34),
    0 0 0 2px rgba(255, 224, 119, 0.4),
    0 6px 0 #70380f,
    0 10px 18px rgba(53, 30, 11, 0.4) !important;
}

#modal-daily-checkin .daily-checkin-day.claimed {
  border-color: #d8ef76 !important;
  background-color: #5c9c34 !important;
  background-image: linear-gradient(180deg, #91cc4b 0%, #5c9b33 54%, #315f22 100%) !important;
}

#modal-daily-checkin .daily-checkin-day.claimed::after {
  content: "✓";
  position: absolute;
  z-index: 4;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 2px solid #efffa8;
  border-radius: 50%;
  background: #3b8a27;
  color: #fffbd0;
  font: 900 16px/1 var(--okey-font-data);
  text-shadow: 0 1px #1b4e16;
}

#modal-daily-checkin .daily-checkin-day.bonus:not(.today):not(.claimed) {
  border-color: #8ddfff !important;
  background-image: linear-gradient(180deg, #6ac9ee 0%, #327caa 58%, #1d476f 100%) !important;
  background-size: auto !important;
}

#modal-daily-checkin .daily-checkin-day-art {
  position: absolute;
  z-index: -1;
  left: 7%;
  bottom: -10%;
  width: 88%;
  height: auto;
  opacity: 0.28;
  filter: saturate(0.82) brightness(0.88);
  image-rendering: pixelated;
}

#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-art {
  left: -10%;
  bottom: -8%;
  width: 120%;
  opacity: 0.82;
  filter: saturate(1.05) brightness(1.02) drop-shadow(0 4px 0 rgba(22, 38, 82, 0.42));
}

#modal-daily-checkin .daily-checkin-day.claimed .daily-checkin-day-art {
  opacity: 0.22;
}

#modal-daily-checkin .daily-checkin-day-copy {
  position: relative;
  z-index: 2;
  height: 100%;
  padding: 6px 3px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  text-shadow: 0 1px rgba(255, 242, 185, 0.9);
}

#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-copy {
  padding: 10px 8px 14px;
  justify-content: flex-start;
  text-shadow: 0 2px 1px rgba(12, 42, 90, 0.88);
}

#modal-daily-checkin .daily-checkin-day-label {
  color: #683514;
  font-family: var(--okey-font-display);
  font-size: 0.58rem;
  font-weight: 900;
  line-height: 1.05;
}

#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-label,
#modal-daily-checkin .daily-checkin-day.claimed .daily-checkin-day-label,
#modal-daily-checkin .daily-checkin-day.bonus .daily-checkin-day-label {
  color: #fff3a8;
}

#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-label {
  font-size: 0.86rem;
}

#modal-daily-checkin .daily-checkin-day b {
  margin-top: 3px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1px 5px;
  color: #4e2a15;
  font-family: var(--okey-font-data);
  font-size: 0.5rem;
  line-height: 1.05;
}

#modal-daily-checkin .daily-checkin-day.today b,
#modal-daily-checkin .daily-checkin-day.claimed b,
#modal-daily-checkin .daily-checkin-day.bonus b {
  color: #fff;
}

#modal-daily-checkin .daily-checkin-day.today b {
  max-width: 112px;
  font-size: 0.68rem;
  gap: 3px 7px;
}

#modal-daily-checkin .daily-checkin-day b span {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

#modal-daily-checkin .daily-checkin-day b .okey-ui-icon {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: #7a481c;
  stroke-width: 1.8;
}

#modal-daily-checkin .daily-checkin-day.today b .okey-ui-icon,
#modal-daily-checkin .daily-checkin-day.claimed b .okey-ui-icon,
#modal-daily-checkin .daily-checkin-day.bonus b .okey-ui-icon {
  stroke: #fff0a2;
}

#modal-daily-checkin .daily-checkin-day small {
  min-height: 0;
  margin-top: auto;
  color: #603314;
  font-size: 0.48rem;
  font-weight: 900;
  line-height: 1;
}

#modal-daily-checkin .daily-checkin-day.today small,
#modal-daily-checkin .daily-checkin-day.claimed small {
  color: #fff6c4;
}

#modal-daily-checkin .daily-checkin-actions {
  position: relative;
  z-index: 5;
  margin: 8px -14px calc(-1 * max(14px, var(--okey-safe-bottom)));
  padding: 10px 14px max(14px, var(--okey-safe-bottom));
  display: grid;
  gap: 8px;
  border-top: 6px solid #6b3413;
  background:
    linear-gradient(90deg, rgba(116, 60, 18, 0.12) 1px, transparent 1px) 0 0 / 18px 100%,
    linear-gradient(180deg, #f7d887 0%, #dda455 100%);
  box-shadow:
    inset 0 3px #ffd98a,
    0 -5px 0 #3f200d,
    0 -11px 20px rgba(68, 35, 11, 0.3);
}

#modal-daily-checkin .daily-checkin-hint {
  margin: 0 !important;
  color: #5d2d12 !important;
  font-family: var(--okey-font-display);
  font-size: 0.82rem !important;
  text-align: center;
  text-shadow: 0 1px #fff0b2;
}

#modal-daily-checkin .daily-checkin-claim {
  min-height: 52px;
  margin: 0;
  border: 4px solid #6b3513 !important;
  border-radius: 5px !important;
  background-color: #e2a225 !important;
  background-image: linear-gradient(180deg, #fff28a 0%, #ffc83d 38%, #e79916 72%, #a8580d 100%) !important;
  background-size: auto !important;
  box-shadow:
    inset 0 0 0 2px #ffe984,
    inset 0 3px rgba(255, 255, 214, 0.78),
    0 5px 0 #74390e,
    0 9px 14px rgba(76, 37, 10, 0.32) !important;
  color: #fff8cc !important;
  font-family: var(--okey-font-display) !important;
  font-size: 1.16rem !important;
  text-shadow: 0 2px 1px #78370c, 1px 0 #78370c, -1px 0 #78370c;
}

#modal-daily-checkin .daily-checkin-claim:disabled {
  border-color: #725235 !important;
  background-image: linear-gradient(180deg, #d7c894, #a58a59 58%, #715536) !important;
  box-shadow: inset 0 0 0 2px #e9d8a0, 0 3px 0 #4b3624 !important;
  color: #fff4cf !important;
  opacity: 0.82;
  transform: none !important;
}

#modal-daily-checkin .daily-checkin-note {
  min-height: 58px;
  padding: 6px 9px;
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 8px;
  border: 2px solid #7a431b;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(255, 241, 185, 0.9), rgba(232, 183, 99, 0.94));
  box-shadow: inset 0 0 0 2px rgba(255, 244, 194, 0.72);
}

#modal-daily-checkin .daily-checkin-note img {
  width: 62px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 3px 0 rgba(91, 47, 16, 0.35));
  image-rendering: pixelated;
}

#modal-daily-checkin .daily-checkin-note p {
  margin: 0;
  color: #5b351a;
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.35;
}

@container okey-stage (max-width: 360px) {
  #modal-daily-checkin .daily-checkin-card {
    padding-inline: 10px !important;
  }

  #modal-daily-checkin .daily-checkin-header {
    margin-right: 52px;
    padding-inline: 10px;
  }

  #modal-daily-checkin .daily-checkin-guide {
    left: -18%;
    width: 78%;
  }

  #modal-daily-checkin .daily-checkin-grid {
    width: 74%;
    gap: 4px !important;
  }

  #modal-daily-checkin .daily-checkin-actions {
    margin-inline: -10px;
    padding-inline: 10px;
  }
}

@container okey-stage (max-height: 720px) {
  #modal-daily-checkin .daily-checkin-stage {
    min-height: 258px;
    margin-top: 66px;
  }

  #modal-daily-checkin .daily-checkin-guide {
    top: 194px;
  }
}

/* Reference-layout pass: scenery, progress rail, seven equal reward slots,
   featured chest, and the primary claim action read as five clear bands. */
#modal-daily-checkin .daily-checkin-card {
  padding:
    max(14px, var(--okey-safe-top))
    10px
    max(12px, var(--okey-safe-bottom)) !important;
  display: flex !important;
  flex-direction: column;
  background-position: center top !important;
}

#modal-daily-checkin .daily-checkin-card::before {
  background:
    linear-gradient(90deg, rgba(47, 26, 9, 0.14), transparent 12%, transparent 88%, rgba(47, 26, 9, 0.14)),
    linear-gradient(180deg, transparent 0 25%, rgba(75, 39, 12, 0.06) 42%, rgba(54, 28, 9, 0.35) 100%);
}

#modal-daily-checkin .daily-checkin-close {
  top: max(14px, var(--okey-safe-top)) !important;
  right: 10px !important;
}

#modal-daily-checkin .daily-checkin-header {
  flex: 0 0 auto;
  width: calc(100% - 60px);
  max-width: 322px;
  min-height: 98px;
  margin: 0;
  padding: 8px 11px 9px;
  border-width: 3px;
  background:
    linear-gradient(90deg, rgba(124, 69, 25, 0.1) 1px, transparent 1px) 0 0 / 16px 100%,
    linear-gradient(180deg, rgba(255, 238, 181, 0.96), rgba(238, 183, 91, 0.97));
}

#modal-daily-checkin .daily-checkin-kicker {
  margin-bottom: 2px;
  padding: 2px 8px;
  font-size: 0.61rem;
}

#modal-daily-checkin .daily-checkin-header h2 {
  font-size: clamp(1.62rem, 7.8cqw, 2.35rem) !important;
}

html:lang(en) #modal-daily-checkin .daily-checkin-header h2 {
  font-size: clamp(1.35rem, 6.6cqw, 1.95rem) !important;
}

#modal-daily-checkin .daily-checkin-subtitle {
  max-width: none;
  margin: 4px 0 0 !important;
  font-size: 0.68rem !important;
  line-height: 1.22 !important;
}

#modal-daily-checkin .daily-checkin-scene {
  z-index: 2;
}

#modal-daily-checkin .daily-checkin-guide {
  display: none;
}

#modal-daily-checkin .daily-checkin-progress {
  position: relative;
  z-index: 5;
  flex: 0 0 88px;
  min-height: 88px;
  margin-top: clamp(48px, 7.5cqh, 72px);
  padding: 10px 12px 10px 78px;
  display: flex;
  align-items: center;
  border: 7px solid #54280e;
  border-radius: 7px;
  background:
    linear-gradient(90deg, rgba(135, 77, 25, 0.11) 1px, transparent 1px) 0 0 / 16px 100%,
    linear-gradient(180deg, #ffe7a6, #e9b55f);
  box-shadow:
    inset 0 0 0 3px #fff0b8,
    inset 0 -7px rgba(116, 57, 15, 0.14),
    0 5px 0 #32170a,
    0 10px 17px rgba(58, 30, 10, 0.38);
}

#modal-daily-checkin .daily-checkin-progress::before,
#modal-daily-checkin .daily-checkin-progress::after {
  content: "";
  position: absolute;
  top: 5px;
  bottom: 5px;
  width: 5px;
  background: linear-gradient(180deg, #9b5319, #4e250d);
  opacity: 0.72;
}

#modal-daily-checkin .daily-checkin-progress::before {
  left: 66px;
}

#modal-daily-checkin .daily-checkin-progress::after {
  right: 4px;
}

#modal-daily-checkin .daily-checkin-progress-emblem {
  position: absolute;
  z-index: 3;
  left: 8px;
  top: 50%;
  width: 58px;
  height: 58px;
  padding: 4px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 4px solid #6d3512;
  border-radius: 6px;
  background: linear-gradient(180deg, #f7d887, #c67b2c);
  box-shadow: inset 0 0 0 2px #fff1ae, 0 4px 0 #38190a;
  transform: translateY(-50%);
}

#modal-daily-checkin .daily-checkin-progress-emblem img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  filter: drop-shadow(0 2px 0 rgba(68, 33, 10, 0.42));
  image-rendering: pixelated;
}

#modal-daily-checkin .daily-checkin-progress-main {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 7px;
}

#modal-daily-checkin .daily-checkin-streak {
  width: fit-content;
  min-width: 0;
  margin: 0;
  padding: 3px 9px;
  border-width: 2px !important;
  font-size: 0.62rem;
  line-height: 1.1;
}

#modal-daily-checkin .daily-checkin-progress-track {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: center;
}

#modal-daily-checkin .daily-checkin-progress-track::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 6%;
  right: 6%;
  top: 50%;
  height: 7px;
  border: 2px solid #5d2e12;
  background: #7a461f;
  box-shadow: inset 0 2px 0 rgba(38, 19, 8, 0.52);
  transform: translateY(-50%);
}

#modal-daily-checkin .daily-checkin-progress-node {
  position: relative;
  z-index: 1;
  width: 23px;
  height: 23px;
  margin: auto;
  display: grid;
  place-items: center;
  border: 3px solid #5b2b10;
  border-radius: 50%;
  background: #59331a;
  box-shadow: inset 0 0 0 2px #2d180d, 0 2px 0 #3b1c0b;
  color: #d8aa65;
}

#modal-daily-checkin .daily-checkin-progress-node i {
  font: 900 0.48rem/1 var(--okey-font-data);
  font-style: normal;
}

#modal-daily-checkin .daily-checkin-progress-node.complete {
  border-color: #d9ef7b;
  background: #58a333;
  box-shadow: inset 0 0 0 2px #2d6d23, 0 2px 0 #2d4e16;
  color: #fff7be;
}

#modal-daily-checkin .daily-checkin-progress-node.current {
  width: 29px;
  height: 29px;
  border-color: #ffdc5f;
  background: radial-gradient(circle at 50% 40%, #72e2ff, #248bc9 58%, #19558c);
  box-shadow:
    inset 0 0 0 2px #fff49d,
    0 0 0 3px #bb6b16,
    0 0 10px rgba(255, 221, 92, 0.8);
  color: #fffbd0;
}

#modal-daily-checkin .daily-checkin-progress-node.current.complete {
  border-color: #e6f58d;
  background: linear-gradient(180deg, #8fd34f, #3d892c);
  box-shadow:
    inset 0 0 0 2px #dfff8d,
    0 0 0 3px #6a3c13,
    0 0 9px rgba(206, 240, 103, 0.72);
  color: #fffbd0;
}

#modal-daily-checkin .daily-checkin-progress-node.current.complete i {
  font-size: 0;
}

#modal-daily-checkin .daily-checkin-progress-node.current.complete i::after {
  content: "✓";
  font: 900 0.82rem/1 var(--okey-font-data);
}

#modal-daily-checkin .daily-checkin-board {
  position: relative;
  z-index: 4;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 10px;
  margin-bottom: clamp(24px, 5cqh, 46px);
  padding: 14px 9px 11px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  border: 7px solid #55280e;
  border-radius: 7px;
  background:
    linear-gradient(90deg, rgba(131, 69, 18, 0.085) 1px, transparent 1px) 0 0 / 18px 100%,
    linear-gradient(180deg, #ffe8aa 0%, #f6cf7f 74%, #d99a45 100%);
  box-shadow:
    inset 0 0 0 3px #fff1b9,
    inset 0 -10px rgba(115, 54, 14, 0.13),
    0 5px 0 #31170a,
    0 12px 20px rgba(55, 28, 9, 0.4);
}

#modal-daily-checkin .daily-checkin-board::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(108, 53, 15, 0.38);
  pointer-events: none;
}

#modal-daily-checkin .daily-checkin-stage {
  z-index: 2;
  min-height: 145px;
  margin: 0;
  display: block;
}

#modal-daily-checkin .daily-checkin-grid {
  width: 100%;
  height: 145px;
  margin: 0;
  display: grid !important;
  grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  grid-template-rows: 1fr;
  grid-auto-flow: column;
  grid-auto-rows: auto;
  gap: 4px !important;
}

#modal-daily-checkin .daily-checkin-day,
#modal-daily-checkin .daily-checkin-day.today {
  order: initial;
  grid-column: auto;
  grid-row: auto;
  min-width: 0;
  min-height: 0 !important;
  height: 139px;
  margin-top: 6px;
  border-width: 2px !important;
  border-radius: 22px 22px 5px 5px !important;
  clip-path: none;
  background-color: #e7bd70 !important;
  background-image:
    radial-gradient(circle at 50% 19%, #f8dda1 0 15px, #95632f 16px 18px, transparent 19px),
    linear-gradient(180deg, #f8dda1 0%, #dfad5e 100%) !important;
  background-size: auto !important;
  box-shadow:
    inset 0 0 0 2px rgba(255, 239, 179, 0.82),
    inset 0 -6px rgba(96, 46, 12, 0.16),
    0 3px 0 #4c260f !important;
  transform: none;
}

#modal-daily-checkin .daily-checkin-day.today {
  height: 145px;
  margin-top: 0;
  border-color: #ffe367 !important;
  background-color: #238ecb !important;
  background-image:
    radial-gradient(circle at 50% 19%, #87e7ff 0 15px, #ffe16d 16px 19px, transparent 20px),
    linear-gradient(180deg, #42b8e9 0%, #237fbd 58%, #174e8d 100%) !important;
  box-shadow:
    inset 0 0 0 2px #8ee9ff,
    inset 0 -7px rgba(12, 50, 100, 0.34),
    0 0 0 2px #a95a13,
    0 4px 0 #63300e,
    0 0 11px rgba(255, 224, 91, 0.68) !important;
}

#modal-daily-checkin .daily-checkin-day.claimed {
  border-color: #d9ef7b !important;
  background-color: #619e3a !important;
  background-image:
    radial-gradient(circle at 50% 19%, #a8d95f 0 15px, #e2f38a 16px 18px, transparent 19px),
    linear-gradient(180deg, #8dc84d 0%, #548d32 58%, #315c23 100%) !important;
}

#modal-daily-checkin .daily-checkin-day.bonus:not(.today):not(.claimed) {
  border-color: #9fe7ff !important;
  background-image:
    radial-gradient(circle at 50% 19%, #91e8ff 0 15px, #e2f8ff 16px 18px, transparent 19px),
    linear-gradient(180deg, #64c8ec 0%, #347fae 58%, #214d76 100%) !important;
}

#modal-daily-checkin .daily-checkin-day.today:not(.claimed)::after,
#modal-daily-checkin .daily-checkin-day.claimed::after {
  position: absolute;
  z-index: 5;
  top: 7px;
  right: 50%;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  transform: translateX(50%);
  font: 900 0.72rem/1 var(--okey-font-data);
}

#modal-daily-checkin .daily-checkin-day.today:not(.claimed)::after {
  content: "◆";
  background: transparent;
  color: #fff8b2;
  text-shadow: 0 1px #126499;
}

#modal-daily-checkin .daily-checkin-day.claimed::after {
  content: "✓";
  background: transparent;
  color: #fffbc2;
  text-shadow: 0 1px #2b6a22;
}

#modal-daily-checkin .daily-checkin-day-art,
#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-art {
  z-index: 1;
  left: 2%;
  bottom: 25px;
  width: 96%;
  opacity: 0.42;
  filter: saturate(0.9) brightness(0.92) drop-shadow(0 2px 0 rgba(67, 35, 11, 0.28));
}

#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-art {
  bottom: 23px;
  opacity: 0.78;
  filter: saturate(1.06) brightness(1.06) drop-shadow(0 3px 0 rgba(12, 47, 91, 0.38));
}

#modal-daily-checkin .daily-checkin-day.claimed .daily-checkin-day-art {
  opacity: 0.28;
}

#modal-daily-checkin .daily-checkin-day-copy,
#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-copy {
  z-index: 3;
  padding: 32px 1px 7px;
  justify-content: space-between;
  text-shadow: 0 1px rgba(255, 241, 181, 0.84);
}

#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-copy,
#modal-daily-checkin .daily-checkin-day.claimed .daily-checkin-day-copy,
#modal-daily-checkin .daily-checkin-day.bonus .daily-checkin-day-copy {
  text-shadow: 0 1px rgba(21, 54, 92, 0.88);
}

#modal-daily-checkin .daily-checkin-day-label,
#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-label {
  font-size: clamp(0.42rem, 1.75cqw, 0.56rem);
  white-space: nowrap;
}

#modal-daily-checkin .daily-checkin-day b,
#modal-daily-checkin .daily-checkin-day.today b {
  margin-top: auto;
  margin-bottom: 12px;
  display: grid;
  gap: 1px;
  font-size: clamp(0.38rem, 1.55cqw, 0.5rem);
  line-height: 1;
}

#modal-daily-checkin .daily-checkin-day b span {
  justify-content: center;
}

#modal-daily-checkin .daily-checkin-day b .okey-ui-icon {
  width: 9px;
  height: 9px;
}

#modal-daily-checkin .daily-checkin-day small {
  width: 100%;
  min-height: 9px;
  margin-top: 0;
  overflow: hidden;
  font-size: clamp(0.34rem, 1.35cqw, 0.44rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

#modal-daily-checkin .daily-checkin-feature {
  position: relative;
  z-index: 2;
  min-height: 176px;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  overflow: hidden;
}

#modal-daily-checkin .daily-checkin-feature::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 34px;
  width: 154px;
  height: 27px;
  border: 3px solid #725025;
  border-radius: 50%;
  background: linear-gradient(180deg, #9a8b58, #5c563c);
  box-shadow: 0 4px 0 rgba(79, 43, 14, 0.32);
  transform: translateX(-50%);
}

#modal-daily-checkin .daily-checkin-feature-glow {
  position: absolute;
  inset: -20px 10% 18px;
  background:
    repeating-conic-gradient(from 0deg, rgba(255, 239, 116, 0.42) 0deg 6deg, transparent 6deg 18deg),
    radial-gradient(circle, rgba(255, 244, 127, 0.9) 0 18%, rgba(255, 207, 65, 0.38) 40%, transparent 67%);
  opacity: 0.82;
  mask-image: radial-gradient(circle, #000 0 35%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle, #000 0 35%, transparent 72%);
}

#modal-daily-checkin .daily-checkin-feature-chest {
  position: relative;
  z-index: 2;
  width: min(55%, 205px);
  height: 143px;
  margin-top: -3px;
  object-fit: contain;
  filter: drop-shadow(0 6px 0 rgba(82, 43, 13, 0.32)) drop-shadow(0 10px 8px rgba(72, 37, 11, 0.2));
  image-rendering: pixelated;
}

#modal-daily-checkin .daily-checkin-feature-chest.opened {
  width: min(58%, 215px);
}

#modal-daily-checkin .daily-checkin-hint {
  position: relative;
  z-index: 3;
  width: 100%;
  margin: 0 !important;
  padding: 4px 7px;
  border: 2px solid rgba(120, 63, 19, 0.55);
  border-radius: 4px;
  background: rgba(255, 232, 166, 0.76);
  font-size: 0.68rem !important;
  line-height: 1.2;
}

#modal-daily-checkin .daily-checkin-actions {
  z-index: 2;
  margin: 0;
  padding: 0;
  gap: 7px;
  border: 0;
  background: none;
  box-shadow: none;
}

#modal-daily-checkin .daily-checkin-claim {
  min-height: 54px;
  font-size: 1.08rem !important;
}

#modal-daily-checkin .daily-checkin-note {
  min-height: 0;
  margin: 0;
  padding: 3px 7px;
  display: block;
  overflow: hidden;
  border: 0;
  background: none;
  box-shadow: none;
  color: #653718;
  font-size: 0.55rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@container okey-stage (max-width: 360px) {
  #modal-daily-checkin .daily-checkin-card {
    padding-inline: 7px !important;
  }

  #modal-daily-checkin .daily-checkin-close {
    right: 7px !important;
  }

  #modal-daily-checkin .daily-checkin-header {
    width: calc(100% - 58px);
    min-height: 92px;
    padding-inline: 9px;
  }

  #modal-daily-checkin .daily-checkin-progress {
    padding-left: 68px;
    border-width: 6px;
  }

  #modal-daily-checkin .daily-checkin-progress::before {
    left: 58px;
  }

  #modal-daily-checkin .daily-checkin-progress-emblem {
    left: 6px;
    width: 50px;
    height: 50px;
  }

  #modal-daily-checkin .daily-checkin-progress-node {
    width: 20px;
    height: 20px;
  }

  #modal-daily-checkin .daily-checkin-progress-node.current {
    width: 26px;
    height: 26px;
  }

  #modal-daily-checkin .daily-checkin-board {
    padding-inline: 6px;
    border-width: 6px;
  }

  #modal-daily-checkin .daily-checkin-grid {
    gap: 2px !important;
  }
}

@container okey-stage (max-height: 760px) {
  #modal-daily-checkin .daily-checkin-card {
    padding-top: max(9px, var(--okey-safe-top)) !important;
  }

  #modal-daily-checkin .daily-checkin-close {
    top: max(9px, var(--okey-safe-top)) !important;
  }

  #modal-daily-checkin .daily-checkin-header {
    min-height: 86px;
    padding-block: 6px;
  }

  #modal-daily-checkin .daily-checkin-kicker {
    display: none;
  }

  #modal-daily-checkin .daily-checkin-header h2 {
    font-size: 1.48rem !important;
  }

  #modal-daily-checkin .daily-checkin-subtitle {
    font-size: 0.62rem !important;
  }

  #modal-daily-checkin .daily-checkin-progress {
    flex-basis: 74px;
    min-height: 74px;
    margin-top: 32px;
    padding-block: 7px;
  }

  #modal-daily-checkin .daily-checkin-board {
    margin-top: 8px;
    margin-bottom: clamp(20px, 4.5cqh, 32px);
    padding-block: 9px 7px;
    gap: 5px;
  }

  #modal-daily-checkin .daily-checkin-stage,
#modal-daily-checkin .daily-checkin-grid {
    min-height: 120px;
    height: 120px;
  }

  #modal-daily-checkin .daily-checkin-day,
#modal-daily-checkin .daily-checkin-day.today {
    height: 116px;
    margin-top: 4px;
  }

  #modal-daily-checkin .daily-checkin-day.today {
    height: 120px;
    margin-top: 0;
  }

  #modal-daily-checkin .daily-checkin-day-copy,
#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-copy {
    padding-top: 29px;
  }

  #modal-daily-checkin .daily-checkin-day b,
#modal-daily-checkin .daily-checkin-day.today b {
    margin-bottom: 6px;
  }

  #modal-daily-checkin .daily-checkin-feature {
    min-height: 123px;
  }

  #modal-daily-checkin .daily-checkin-feature::before {
    bottom: 29px;
    width: 125px;
  }

  #modal-daily-checkin .daily-checkin-feature-chest,
#modal-daily-checkin .daily-checkin-feature-chest.opened {
    width: min(46%, 164px);
    height: 94px;
  }

  #modal-daily-checkin .daily-checkin-hint {
    padding-block: 2px;
    font-size: 0.61rem !important;
  }

  #modal-daily-checkin .daily-checkin-claim {
    min-height: 50px;
  }

  #modal-daily-checkin .daily-checkin-note {
    display: none;
  }
}

/* Final reference-detail polish. */
#modal-daily-checkin .daily-checkin-close {
  width: 60px !important;
  height: 60px !important;
  min-width: 60px !important;
  min-height: 60px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: transparent !important;
  font-size: 0 !important;
  text-shadow: none !important;
  overflow: visible;
  appearance: none;
}

#modal-daily-checkin .daily-checkin-close-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  filter:
    drop-shadow(0 3px 0 rgba(39, 18, 6, 0.92))
    drop-shadow(0 7px 8px rgba(42, 20, 7, 0.38));
  transition: transform 120ms ease, filter 120ms ease;
}

#modal-daily-checkin .daily-checkin-close:is(:hover, :focus-visible) .daily-checkin-close-art {
  filter:
    brightness(1.08)
    drop-shadow(0 3px 0 rgba(39, 18, 6, 0.92))
    drop-shadow(0 7px 8px rgba(42, 20, 7, 0.38));
}

#modal-daily-checkin .daily-checkin-close:active .daily-checkin-close-art {
  transform: translateY(2px) scale(0.96);
  filter: brightness(0.96) drop-shadow(0 2px 0 rgba(39, 18, 6, 0.92));
}

#modal-daily-checkin .daily-checkin-header {
  width: calc(100% - 72px);
  min-height: 90px;
  padding: 7px 11px 8px;
  border: 4px solid #4f250d;
  background:
    radial-gradient(circle at 8px 8px, #f8d173 0 2px, #7b3d14 3px 4px, transparent 5px),
    radial-gradient(circle at calc(100% - 8px) 8px, #f8d173 0 2px, #7b3d14 3px 4px, transparent 5px),
    repeating-linear-gradient(90deg, rgba(120, 62, 17, 0.085) 0 1px, transparent 1px 16px),
    linear-gradient(180deg, #ffedba, #eeb866);
  box-shadow:
    inset 0 0 0 3px #fff0b7,
    inset 0 -6px rgba(111, 52, 14, 0.16),
    0 5px 0 #2f1508,
    0 9px 16px rgba(60, 31, 10, 0.32);
}

#modal-daily-checkin .daily-checkin-header::before {
  inset: 6px;
  border-color: rgba(112, 55, 14, 0.32);
}

#modal-daily-checkin .daily-checkin-kicker {
  border-color: #2f5d21;
  background: linear-gradient(180deg, #91d34e, #48842c);
  box-shadow: inset 0 0 0 1px #c9ef82, 0 2px 0 #315c22;
  font-family: var(--okey-font-ui) !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-shadow: 0 1px 0 #244b18 !important;
}

#modal-daily-checkin .daily-checkin-header h2 {
  font-family: var(--okey-font-display) !important;
  font-weight: 700 !important;
  font-size: clamp(1.48rem, 7cqw, 2.12rem) !important;
  line-height: 1.06 !important;
  letter-spacing: 0.08em !important;
  text-shadow: 1px 1px 0 #ffe5a4, 0 2px 0 rgba(95, 43, 11, 0.2) !important;
}

html:lang(en) #modal-daily-checkin .daily-checkin-header h2 {
  font-size: clamp(1.24rem, 5.9cqw, 1.78rem) !important;
  letter-spacing: 0.035em !important;
}

#modal-daily-checkin .daily-checkin-subtitle {
  color: #4c2915 !important;
  font-family: var(--okey-font-ui) !important;
  font-weight: 400 !important;
  font-size: 0.65rem !important;
}

#modal-daily-checkin .daily-checkin-progress {
  border-width: 5px;
  border-color: #3c1b08;
  background:
    radial-gradient(circle at 8px 8px, #f5c75a 0 2px, #5b2a0d 3px 4px, transparent 5px),
    radial-gradient(circle at calc(100% - 8px) 8px, #f5c75a 0 2px, #5b2a0d 3px 4px, transparent 5px),
    repeating-linear-gradient(90deg, rgba(120, 62, 17, 0.08) 0 1px, transparent 1px 15px),
    linear-gradient(180deg, #ffe8a6, #e7ad55);
  box-shadow:
    inset 0 0 0 3px #fff2be,
    inset 0 -7px rgba(104, 49, 13, 0.16),
    0 5px 0 #281207,
    0 9px 15px rgba(53, 27, 9, 0.36);
}

#modal-daily-checkin .daily-checkin-progress-emblem {
  overflow: visible;
  border: 4px solid #3f1c09;
  background:
    linear-gradient(90deg, rgba(75, 39, 16, 0.16) 0 2px, transparent 2px 8px),
    linear-gradient(180deg, #9d9b86, #5b5548);
  box-shadow:
    inset 0 0 0 3px #d7caa2,
    inset 0 -5px rgba(31, 24, 18, 0.34),
    0 4px 0 #2b1307;
}

#modal-daily-checkin .daily-checkin-flame {
  width: 43px;
  height: 43px;
  overflow: visible;
  shape-rendering: crispEdges;
  filter: drop-shadow(0 3px 0 rgba(40, 20, 7, 0.65));
}

#modal-daily-checkin .daily-checkin-flame-outline {
  fill: #351307;
}

#modal-daily-checkin .daily-checkin-flame-red {
  fill: #d63b12;
}

#modal-daily-checkin .daily-checkin-flame-gold {
  fill: #ff9d16;
}

#modal-daily-checkin .daily-checkin-flame-core {
  fill: #fff69c;
}

#modal-daily-checkin .daily-checkin-progress-track::before {
  height: 8px;
  border-color: #3d1c0a;
  background: linear-gradient(180deg, #a86427, #613317);
  box-shadow: inset 0 2px 0 rgba(255, 195, 90, 0.22), 0 2px 0 rgba(69, 30, 8, 0.4);
}

#modal-daily-checkin .daily-checkin-progress-node {
  border-color: #3c1a08;
  background: radial-gradient(circle at 38% 32%, #724321, #382012 68%);
}

#modal-daily-checkin .daily-checkin-progress-node.current {
  border-color: #ffde57;
  background: radial-gradient(circle at 42% 34%, #a0f1ff, #259ed7 48%, #155b96 78%);
}

#modal-daily-checkin .daily-checkin-board {
  padding: 18px 13px 14px;
  border: 5px solid #321606;
  border-radius: 8px;
  background:
    radial-gradient(circle at 9px 9px, #f4bf45 0 2px, #4d2109 3px 5px, transparent 6px),
    radial-gradient(circle at calc(100% - 9px) 9px, #f4bf45 0 2px, #4d2109 3px 5px, transparent 6px),
    radial-gradient(circle at 9px calc(100% - 9px), #f4bf45 0 2px, #4d2109 3px 5px, transparent 6px),
    radial-gradient(circle at calc(100% - 9px) calc(100% - 9px), #f4bf45 0 2px, #4d2109 3px 5px, transparent 6px),
    repeating-linear-gradient(0deg, rgba(55, 24, 7, 0.28) 0 2px, transparent 2px 12px),
    linear-gradient(90deg, #6c3010, #a65318 18%, #74320f 50%, #a65318 82%, #63290d);
  box-shadow:
    inset 0 0 0 3px #c2782c,
    inset 0 0 0 6px rgba(61, 25, 6, 0.48),
    0 5px 0 #211006,
    0 12px 20px rgba(48, 24, 8, 0.46);
}

#modal-daily-checkin .daily-checkin-board::before {
  z-index: 0;
  inset: 10px;
  border: 3px solid #c68a3d;
  border-radius: 3px;
  background:
    radial-gradient(circle at 18% 22%, rgba(151, 82, 24, 0.08) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 69%, rgba(151, 82, 24, 0.07) 0 1px, transparent 2px),
    repeating-linear-gradient(90deg, rgba(133, 70, 18, 0.055) 0 1px, transparent 1px 18px),
    linear-gradient(180deg, #ffedb8, #f1c773 76%, #d9953e);
  box-shadow:
    inset 0 0 0 2px #fff3c2,
    inset 0 -12px rgba(117, 54, 13, 0.1);
  clip-path: polygon(0 2%, 2% 0, 98% 0, 100% 2%, 100% 97%, 98% 100%, 94% 98%, 89% 100%, 84% 98%, 78% 100%, 73% 98%, 66% 100%, 60% 98%, 54% 100%, 47% 98%, 41% 100%, 34% 98%, 27% 100%, 21% 98%, 15% 100%, 9% 98%, 3% 100%, 0 97%);
}

#modal-daily-checkin .daily-checkin-board::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 14px;
  right: 14px;
  top: 14px;
  height: 4px;
  background: linear-gradient(90deg, transparent, rgba(255, 247, 204, 0.72) 12%, rgba(255, 247, 204, 0.72) 88%, transparent);
  pointer-events: none;
}

#modal-daily-checkin .daily-checkin-stage,
#modal-daily-checkin .daily-checkin-feature,
#modal-daily-checkin .daily-checkin-actions {
  position: relative;
  z-index: 2;
}

#modal-daily-checkin .daily-checkin-grid {
  gap: 5px !important;
}

#modal-daily-checkin .daily-checkin-day,
#modal-daily-checkin .daily-checkin-day.today {
  border-color: #694018 !important;
  background-image:
    radial-gradient(circle at 50% 19%, #f7d995 0 14px, #76502d 15px 18px, #d7a95e 19px 20px, transparent 21px),
    repeating-linear-gradient(90deg, rgba(109, 53, 13, 0.06) 0 1px, transparent 1px 10px),
    linear-gradient(180deg, #f8dda0, #d8a458) !important;
  box-shadow:
    inset 0 0 0 2px #ffe7a5,
    inset 0 -7px rgba(91, 42, 10, 0.19),
    0 4px 0 #42200c,
    0 7px 9px rgba(66, 32, 10, 0.22) !important;
}

#modal-daily-checkin .daily-checkin-day.today {
  border-color: #ffe160 !important;
  background-image:
    radial-gradient(circle at 50% 19%, #85eaff 0 14px, #ffe16c 15px 19px, #9b5718 20px 21px, transparent 22px),
    radial-gradient(circle at 50% 74%, rgba(100, 224, 255, 0.62), transparent 48%),
    linear-gradient(180deg, #43bae8, #237ebc 58%, #164b88) !important;
  box-shadow:
    inset 0 0 0 2px #9deeff,
    inset 0 -8px rgba(8, 38, 88, 0.36),
    0 0 0 2px #8c4b13,
    0 5px 0 #4d250c,
    0 0 13px rgba(255, 226, 90, 0.78) !important;
}

#modal-daily-checkin .daily-checkin-day.claimed {
  border-color: #daf07b !important;
  background-image:
    radial-gradient(circle at 50% 19%, #b8e66b 0 14px, #efff9b 15px 18px, #5f8b2f 19px 20px, transparent 21px),
    linear-gradient(180deg, #91c951, #4f8932 60%, #2d5822) !important;
}

#modal-daily-checkin .daily-checkin-day.bonus:not(.today):not(.claimed) {
  border-color: #a5ebff !important;
  background-image:
    radial-gradient(circle at 50% 19%, #9eecff 0 14px, #e9fbff 15px 18px, #3d7da4 19px 20px, transparent 21px),
    radial-gradient(circle at 50% 75%, rgba(92, 211, 255, 0.38), transparent 46%),
    linear-gradient(180deg, #68c9eb, #337ca9 58%, #214a71) !important;
}

#modal-daily-checkin .daily-checkin-day-art,
#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-art {
  left: -7%;
  width: 114%;
  opacity: 0.52;
}

#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-art {
  left: -11%;
  width: 122%;
  opacity: 0.88;
}

#modal-daily-checkin .daily-checkin-day b,
#modal-daily-checkin .daily-checkin-day.today b {
  font-size: clamp(0.4rem, 1.7cqw, 0.53rem);
  text-shadow: 0 1px rgba(255, 240, 178, 0.64);
}

#modal-daily-checkin .daily-checkin-day.today b,
#modal-daily-checkin .daily-checkin-day.claimed b,
#modal-daily-checkin .daily-checkin-day.bonus b {
  text-shadow: 0 1px #173d62;
}

#modal-daily-checkin .daily-checkin-feature {
  overflow: visible;
}

#modal-daily-checkin .daily-checkin-feature::before {
  z-index: 2;
  bottom: 31px;
  width: min(58%, 212px);
  height: 35px;
  border: 3px solid #655431;
  background:
    radial-gradient(ellipse at 12% 38%, #bbb08c 0 9%, transparent 10%),
    radial-gradient(ellipse at 35% 58%, #817b65 0 12%, transparent 13%),
    radial-gradient(ellipse at 60% 42%, #aaa181 0 13%, transparent 14%),
    radial-gradient(ellipse at 86% 57%, #6c6a58 0 11%, transparent 12%),
    linear-gradient(180deg, #a99f7e, #625d4c);
  box-shadow: inset 0 3px rgba(227, 218, 174, 0.42), 0 5px 0 rgba(70, 38, 13, 0.34);
}

#modal-daily-checkin .daily-checkin-feature::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 31px;
  width: min(68%, 242px);
  height: 48px;
  background: linear-gradient(90deg, #3e7a2a, #6caa43 18%, #367126 36%, #5b9b36 64%, #70ad45 82%, #3a7629);
  clip-path: polygon(0 100%, 4% 64%, 9% 100%, 14% 34%, 20% 100%, 26% 54%, 33% 100%, 39% 68%, 45% 100%, 55% 100%, 61% 68%, 67% 100%, 74% 54%, 80% 100%, 86% 34%, 91% 100%, 96% 64%, 100% 100%);
  filter: drop-shadow(0 3px 0 rgba(53, 77, 28, 0.34));
  transform: translateX(-50%);
}

#modal-daily-checkin .daily-checkin-feature-glow {
  inset: -35px 1% 8px;
  opacity: 0.94;
}

#modal-daily-checkin .daily-checkin-feature-glow::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 42%;
  width: 5px;
  height: 5px;
  background: #fff9b1;
  box-shadow:
    -92px -26px 0 #ffe86d,
    -70px 22px 0 #fff7ac,
    -48px -46px 0 #ffe86d,
    53px -42px 0 #fff7ac,
    76px 15px 0 #ffe86d,
    96px -18px 0 #fff7ac;
  transform: rotate(45deg);
}

#modal-daily-checkin .daily-checkin-feature-chest,
#modal-daily-checkin .daily-checkin-feature-chest.opened {
  z-index: 3;
  align-self: end;
  width: min(64%, 238px);
  height: 168px;
  margin-bottom: 28px;
  filter:
    drop-shadow(0 5px 0 rgba(68, 34, 10, 0.38))
    drop-shadow(0 11px 10px rgba(63, 31, 9, 0.24));
}

#modal-daily-checkin .daily-checkin-hint {
  width: calc(100% - 12px);
  border-color: #8c501d;
  background:
    repeating-linear-gradient(90deg, rgba(123, 65, 18, 0.06) 0 1px, transparent 1px 14px),
    linear-gradient(180deg, rgba(255, 239, 183, 0.96), rgba(234, 183, 94, 0.96));
  box-shadow: inset 0 0 0 2px rgba(255, 244, 196, 0.62);
}

#modal-daily-checkin .daily-checkin-claim {
  position: relative;
  min-height: 58px;
  overflow: hidden;
  border-width: 5px !important;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 205, 0.3), transparent 13%, transparent 87%, rgba(255, 255, 205, 0.3)),
    linear-gradient(180deg, #fff58f 0%, #ffd33e 35%, #e99a15 72%, #9e4a09 100%) !important;
  box-shadow:
    inset 0 0 0 3px #ffe876,
    inset 0 4px rgba(255, 255, 220, 0.7),
    0 5px 0 #572707,
    0 9px 14px rgba(65, 31, 8, 0.32) !important;
}

#modal-daily-checkin .daily-checkin-claim::before,
#modal-daily-checkin .daily-checkin-claim::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  border: 2px solid #8e430c;
  background: #fff2a2;
  box-shadow: 0 2px 0 #773309;
  transform: translateY(-50%) rotate(45deg);
}

#modal-daily-checkin .daily-checkin-claim::before {
  left: 10px;
}

#modal-daily-checkin .daily-checkin-claim::after {
  right: 10px;
}

@container okey-stage (max-width: 360px) {
  #modal-daily-checkin .daily-checkin-board {
    padding-inline: 10px;
  }

  #modal-daily-checkin .daily-checkin-grid {
    gap: 3px !important;
  }

  #modal-daily-checkin .daily-checkin-feature-chest,
#modal-daily-checkin .daily-checkin-feature-chest.opened {
    width: min(65%, 200px);
  }
}

@container okey-stage (max-height: 760px) {
  #modal-daily-checkin .daily-checkin-header {
    min-height: 82px;
  }

  #modal-daily-checkin .daily-checkin-feature-chest,
#modal-daily-checkin .daily-checkin-feature-chest.opened {
    width: min(54%, 174px);
    height: 118px;
    margin-bottom: 24px;
  }

  #modal-daily-checkin .daily-checkin-feature::before,
#modal-daily-checkin .daily-checkin-feature::after {
    bottom: 27px;
  }

  #modal-daily-checkin .daily-checkin-claim {
    min-height: 52px;
  }
}

/* High-fidelity daily check-in composition matched to the approved concept. */
#modal-daily-checkin .daily-checkin-card {
  min-height: 100cqh;
  padding: max(3cqh, var(--okey-safe-top)) max(0px, var(--okey-safe-right)) max(2.4cqh, var(--okey-safe-bottom)) max(0px, var(--okey-safe-left)) !important;
  display: flex !important;
  flex-direction: column;
  gap: 0;
  overflow: hidden !important;
  box-sizing: border-box;
  filter: brightness(0.92);
}

#modal-daily-checkin .daily-checkin-card::before {
  background:
    linear-gradient(90deg, rgba(48, 28, 10, 0.08), transparent 12%, transparent 88%, rgba(48, 28, 10, 0.08)),
    linear-gradient(180deg, transparent 0 68%, rgba(69, 38, 13, 0.08) 88%, rgba(46, 26, 9, 0.18) 100%);
}

#modal-daily-checkin .daily-checkin-guide,
#modal-daily-checkin .daily-checkin-kicker {
  display: none !important;
}

#modal-daily-checkin .daily-checkin-close {
  top: max(1.55cqh, var(--okey-safe-top)) !important;
  right: max(3.6%, var(--okey-safe-right)) !important;
  width: clamp(40px, 11.3cqw, 48px) !important;
  height: clamp(40px, 11.3cqw, 48px) !important;
  min-width: 40px !important;
  min-height: 40px !important;
}

#modal-daily-checkin .daily-checkin-header {
  flex: 0 0 12.7cqh;
  width: 76.3%;
  max-width: none;
  min-height: 0;
  margin: 0 0 0 9.6%;
  padding: 1.2cqh 12px 0.9cqh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: clamp(6px, 0.86cqh, 8px) solid #5a2b0d;
  border-radius: 3px;
  background:
    repeating-linear-gradient(90deg, rgba(127, 67, 18, 0.055) 0 1px, transparent 1px 17px),
    linear-gradient(180deg, #ffecb3, #edba68);
  box-shadow:
    inset 0 0 0 3px #fff2c0,
    inset 0 0 0 5px rgba(139, 74, 22, 0.24),
    0 0 0 3px #a35a1c,
    0 5px 0 #321607,
    0 9px 13px rgba(48, 25, 8, 0.32);
  box-sizing: border-box;
}

#modal-daily-checkin .daily-checkin-header::before {
  inset: 4px;
  border: 1px solid rgba(106, 53, 14, 0.42);
}

#modal-daily-checkin .daily-checkin-header h2 {
  font-size: clamp(1.85rem, 4.2cqh, 2.22rem) !important;
  line-height: 1 !important;
  letter-spacing: 0.07em !important;
}

html:lang(en) #modal-daily-checkin .daily-checkin-header h2 {
  font-size: clamp(1.32rem, 3.25cqh, 1.78rem) !important;
  letter-spacing: 0.01em !important;
}

#modal-daily-checkin .daily-checkin-subtitle {
  max-width: none;
  margin: 0.75cqh 0 0 !important;
  font-size: clamp(0.68rem, 1.45cqh, 0.82rem) !important;
  line-height: 1.15 !important;
  font-weight: 700 !important;
  text-align: center;
}

#modal-daily-checkin .daily-checkin-progress {
  position: relative;
  z-index: 5;
  flex: 0 0 8.5cqh;
  width: 89.5%;
  min-height: 0;
  margin: 1.45cqh auto 0;
  padding: 0.75cqh 10px 0.7cqh clamp(58px, 16cqw, 70px);
  display: flex;
  align-items: center;
  border: clamp(5px, 0.72cqh, 7px) solid #54270c;
  border-radius: 4px;
  background:
    repeating-linear-gradient(90deg, rgba(127, 67, 18, 0.055) 0 1px, transparent 1px 17px),
    linear-gradient(180deg, #ffecb1, #e7aa4d);
  box-shadow:
    inset 0 0 0 3px #fff1bb,
    inset 0 -5px rgba(121, 57, 13, 0.14),
    0 0 0 2px #9d571d,
    0 4px 0 #311607,
    0 8px 12px rgba(48, 25, 8, 0.28);
  box-sizing: border-box;
}

#modal-daily-checkin .daily-checkin-progress::before {
  left: clamp(51px, 14cqw, 62px);
  top: 4px;
  bottom: 4px;
  width: 4px;
}

#modal-daily-checkin .daily-checkin-progress::after {
  right: 3px;
  top: 4px;
  bottom: 4px;
  width: 4px;
}

#modal-daily-checkin .daily-checkin-progress-emblem {
  left: 7px;
  width: clamp(42px, 12cqw, 52px);
  height: clamp(42px, 12cqw, 52px);
  padding: 2px;
  border-width: 3px;
}

#modal-daily-checkin .daily-checkin-flame {
  width: clamp(31px, 9cqw, 39px);
  height: clamp(31px, 9cqw, 39px);
}

#modal-daily-checkin .daily-checkin-progress-main {
  gap: 0.55cqh;
}

#modal-daily-checkin .daily-checkin-streak {
  min-width: 0;
  padding: 2px 8px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #5d2c0f;
  font-size: clamp(0.76rem, 1.75cqh, 0.96rem);
  text-align: left;
  text-shadow: 0 1px #fff2b7;
}

#modal-daily-checkin .daily-checkin-streak::first-letter {
  color: inherit;
}

#modal-daily-checkin .daily-checkin-streak b {
  color: #218833;
  font-size: 1.2em;
  text-shadow: 0 1px #d9f2a1;
}

#modal-daily-checkin .daily-checkin-progress-track {
  grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
}

#modal-daily-checkin .daily-checkin-progress-track::before {
  left: 5%;
  right: 5%;
  height: 5px;
  border-width: 1px;
}

#modal-daily-checkin .daily-checkin-progress-node {
  width: clamp(22px, 6.6cqw, 29px);
  height: clamp(22px, 6.6cqw, 29px);
  border-width: 2px;
}

#modal-daily-checkin .daily-checkin-progress-node.current {
  width: clamp(26px, 7.7cqw, 33px);
  height: clamp(26px, 7.7cqw, 33px);
}

#modal-daily-checkin .daily-checkin-progress-node i {
  font-size: clamp(0.48rem, 1.25cqh, 0.66rem);
}

#modal-daily-checkin .daily-checkin-board {
  position: relative;
  z-index: 4;
  flex: 1 1 auto;
  width: 98.5%;
  min-height: 0;
  margin: 2.5cqh auto 0;
  padding: 1.6cqh 13px 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 17.55cqh;
  gap: 0.55cqh;
  overflow: hidden;
  border: clamp(5px, 0.72cqh, 7px) solid #4c2108;
  border-radius: 3px;
  background:
    radial-gradient(circle at 8px 8px, #f4bf45 0 2px, #4d2109 3px 5px, transparent 6px),
    radial-gradient(circle at calc(100% - 8px) 8px, #f4bf45 0 2px, #4d2109 3px 5px, transparent 6px),
    repeating-linear-gradient(90deg, rgba(126, 66, 17, 0.05) 0 1px, transparent 1px 18px),
    linear-gradient(180deg, #ffecb5 0%, #f3c36d 76%, #dc9840 100%);
  box-shadow:
    inset 0 0 0 3px #c87928,
    inset 0 0 0 6px rgba(71, 29, 7, 0.34),
    0 0 0 2px #a45b1c,
    0 4px 0 #251005,
    0 8px 14px rgba(43, 21, 7, 0.34);
  box-sizing: border-box;
}

#modal-daily-checkin .daily-checkin-board::before {
  inset: 7px;
  border: 2px solid rgba(128, 67, 18, 0.4);
  border-radius: 2px;
}

#modal-daily-checkin .daily-checkin-board::after {
  content: none;
}

#modal-daily-checkin .daily-checkin-stage {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  display: block;
  overflow: visible;
}

#modal-daily-checkin .daily-checkin-grid {
  width: calc(100% - 8px);
  height: 100%;
  min-height: 0;
  margin: 0;
  padding-top: 4px;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-template-rows: minmax(0, 1.075fr) minmax(0, 1fr);
  grid-auto-flow: row;
  grid-auto-rows: minmax(0, 1fr);
  gap: 8px !important;
  box-sizing: border-box;
}

#modal-daily-checkin .daily-checkin-day,
#modal-daily-checkin .daily-checkin-day.today {
  position: relative;
  order: initial;
  grid-column: auto;
  grid-row: auto;
  min-width: 0;
  min-height: 0 !important;
  height: auto;
  margin: 0;
  padding: 5px 5px 4px !important;
  display: grid !important;
  grid-template-rows: clamp(23px, 3.15cqh, 28px) minmax(46px, 1fr) auto clamp(20px, 2.75cqh, 24px);
  align-items: center;
  justify-items: stretch;
  gap: 2px;
  overflow: hidden;
  border-width: 2px !important;
  border-radius: 10px 10px 4px 4px !important;
  box-sizing: border-box;
  transform: none;
}

#modal-daily-checkin .daily-checkin-day.bonus {
  grid-column: span 2;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: clamp(23px, 3.15cqh, 28px) minmax(64px, 1fr) clamp(25px, 3.45cqh, 30px);
}

#modal-daily-checkin .daily-checkin-day,
#modal-daily-checkin .daily-checkin-day.today {
  border-color: #794312 !important;
  background-color: #e7bd70 !important;
  background-image:
    repeating-linear-gradient(90deg, rgba(109, 53, 13, 0.05) 0 1px, transparent 1px 11px),
    linear-gradient(180deg, #fff0c4 0%, #efcb8f 72%, #daa45d 100%) !important;
  box-shadow:
    inset 0 0 0 2px #fff0bb,
    inset 0 0 0 4px rgba(188, 119, 39, 0.22),
    inset 0 -5px rgba(91, 42, 10, 0.14),
    0 3px 0 #4b250d !important;
}

#modal-daily-checkin .daily-checkin-day.today {
  border-color: #ffca2b !important;
  background-color: #218bc8 !important;
  background-image:
    radial-gradient(circle at 50% 46%, rgba(139, 236, 255, 0.78), transparent 44%),
    linear-gradient(155deg, transparent 0 43%, rgba(255, 246, 154, 0.18) 44% 52%, transparent 53%),
    linear-gradient(180deg, #24a9e3, #1477bd 58%, #0c4e91) !important;
  box-shadow:
    inset 0 0 0 2px #c4f7ff,
    inset 0 0 0 4px #1689c8,
    inset 0 -7px rgba(8, 38, 88, 0.32),
    0 0 0 2px #75400f,
    0 4px 0 #4d250c,
    0 0 10px rgba(255, 218, 62, 0.62) !important;
}

#modal-daily-checkin .daily-checkin-day.claimed,
#modal-daily-checkin .daily-checkin-day.today.claimed {
  border-color: #386d21 !important;
  background-color: #669d35 !important;
  background-image:
    linear-gradient(155deg, transparent 0 43%, rgba(240, 255, 172, 0.12) 44% 52%, transparent 53%),
    linear-gradient(180deg, #92c953, #5a9137 60%, #315b25) !important;
  box-shadow:
    inset 0 0 0 2px #dff493,
    inset 0 0 0 4px rgba(58, 112, 36, 0.45),
    inset 0 -6px rgba(31, 78, 25, 0.27),
    0 3px 0 #294917 !important;
}

#modal-daily-checkin .daily-checkin-day.bonus:not(.today):not(.claimed) {
  border-color: #194f83 !important;
  background-color: #168cc3 !important;
  background-image:
    radial-gradient(circle at 50% 55%, rgba(112, 225, 255, 0.74), transparent 47%),
    linear-gradient(155deg, transparent 0 43%, rgba(225, 250, 255, 0.17) 44% 52%, transparent 53%),
    linear-gradient(180deg, #149bcf, #0f6fa9 58%, #0a4476) !important;
  box-shadow:
    inset 0 0 0 2px #bff5ff,
    inset 0 0 0 4px #258fc1,
    inset 0 -7px rgba(16, 56, 91, 0.32),
    0 3px 0 #173e60 !important;
}

#modal-daily-checkin .daily-checkin-day.today:not(.claimed)::after,
#modal-daily-checkin .daily-checkin-day.claimed::after {
  content: none !important;
  display: none !important;
}

#modal-daily-checkin .daily-checkin-day-label,
#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-label {
  position: relative;
  z-index: 4;
  width: calc(100% - 2px);
  max-width: 100%;
  height: 100%;
  margin: 0 auto;
  padding: 2px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #d6a354;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(255, 241, 197, 0.98), rgba(242, 197, 116, 0.98));
  box-shadow: inset 0 1px rgba(255, 255, 224, 0.78), 0 2px 0 rgba(116, 59, 15, 0.18);
  color: #673110;
  font-family: var(--okey-font-ui) !important;
  font-size: clamp(0.74rem, 1.78cqh, 0.92rem);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px rgba(255, 248, 203, 0.86);
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}

#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-label,
#modal-daily-checkin .daily-checkin-day.bonus .daily-checkin-day-label {
  border-color: #d8f5ff;
  background: linear-gradient(180deg, #147fc2, #07558f);
  color: #fff8d5;
  text-shadow: 0 1px #173e65;
}

#modal-daily-checkin .daily-checkin-day.claimed .daily-checkin-day-label {
  border-color: #d8ed8b;
  background: linear-gradient(180deg, #6da13d, #386629);
  color: #fff8d5;
  text-shadow: 0 1px #315624;
}

#modal-daily-checkin .daily-checkin-day.bonus .daily-checkin-day-label {
  grid-column: 1;
  grid-row: 1;
}

#modal-daily-checkin .daily-checkin-day-visual {
  position: relative;
  z-index: 2;
  width: clamp(58px, 18.2cqw, 78px);
  height: clamp(58px, 18.2cqw, 78px);
  max-width: 100%;
  margin: 0 auto;
  display: grid;
  place-items: center;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  box-sizing: border-box;
}

#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-visual {
  border: 0;
  background: radial-gradient(circle, rgba(163, 240, 255, 0.6), transparent 66%);
  box-shadow: none;
}

#modal-daily-checkin .daily-checkin-day.bonus .daily-checkin-day-visual {
  grid-column: 1;
  grid-row: 2;
  width: clamp(94px, 31cqw, 132px);
  height: clamp(82px, 24cqw, 110px);
  border: 0;
  background: radial-gradient(circle, rgba(193, 245, 255, 0.64), rgba(67, 194, 235, 0.2) 46%, transparent 68%);
  box-shadow: none;
}

#modal-daily-checkin .daily-checkin-day.claimed .daily-checkin-day-visual {
  border: 0;
  background: radial-gradient(circle, rgba(204, 239, 121, 0.38), transparent 68%);
  box-shadow: none;
}

#modal-daily-checkin .daily-checkin-day-art,
#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-art {
  position: static !important;
  z-index: 2;
  width: clamp(72px, 23.5cqw, 96px) !important;
  max-width: none;
  height: clamp(72px, 23.5cqw, 96px);
  display: block;
  object-fit: contain;
  opacity: 1 !important;
  filter: saturate(1.05) brightness(1.04) drop-shadow(0 3px 0 rgba(66, 31, 8, 0.3));
  transform: none;
}

#modal-daily-checkin .daily-checkin-day.bonus .daily-checkin-day-art {
  width: clamp(136px, 41cqw, 174px) !important;
  height: clamp(112px, 34cqw, 144px);
  filter:
    hue-rotate(168deg)
    saturate(0.88)
    brightness(1.18)
    drop-shadow(0 3px 0 rgba(17, 53, 80, 0.36));
  transform: translateX(-22px);
}

#modal-daily-checkin .daily-checkin-day.bonus .daily-checkin-day-visual::before,
#modal-daily-checkin .daily-checkin-day.bonus .daily-checkin-day-visual::after {
  content: "";
  position: absolute;
  z-index: 4;
  width: 6px;
  height: 6px;
  background: #e8fbff;
  box-shadow: 0 0 7px rgba(206, 247, 255, 0.95);
  transform: rotate(45deg);
}

#modal-daily-checkin .daily-checkin-day.bonus .daily-checkin-day-visual::before {
  left: -6px;
  top: 28%;
}

#modal-daily-checkin .daily-checkin-day.bonus .daily-checkin-day-visual::after {
  right: -4px;
  bottom: 24%;
}

#modal-daily-checkin .daily-checkin-day.claimed .daily-checkin-day-art {
  display: block;
  filter: saturate(0.78) brightness(0.82) drop-shadow(0 3px 0 rgba(38, 65, 19, 0.28));
}

#modal-daily-checkin .daily-checkin-claimed-mark {
  display: none;
}

#modal-daily-checkin .daily-checkin-day.claimed .daily-checkin-claimed-mark {
  position: absolute;
  z-index: 4;
  right: -2px;
  bottom: -1px;
  width: clamp(36px, 11cqw, 47px);
  height: clamp(36px, 11cqw, 47px);
  display: grid;
  place-items: center;
  border: 3px solid #efffa8;
  border-radius: 9px;
  background: linear-gradient(180deg, #91df3f, #2e9c27);
  box-shadow: inset 0 0 0 2px rgba(35, 112, 31, 0.38), 0 3px 0 #265f1d;
  color: #fffbd0;
  font: 900 clamp(24px, 7.5cqw, 32px)/1 var(--okey-font-data);
  text-shadow: 0 2px #296020;
  transform: rotate(-8deg);
}

#modal-daily-checkin .daily-checkin-reward-list,
#modal-daily-checkin .daily-checkin-day.today .daily-checkin-reward-list {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: none;
  margin: 0 !important;
  display: grid !important;
  align-self: end;
  gap: 3px !important;
  color: #4e2a15;
  font-family: var(--okey-font-data);
  line-height: 1;
  text-shadow: none !important;
}

#modal-daily-checkin .daily-checkin-day.bonus .daily-checkin-reward-list {
  grid-column: 1;
  grid-row: 3;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-self: stretch;
  gap: 4px !important;
}

#modal-daily-checkin .daily-checkin-day b .daily-checkin-reward,
#modal-daily-checkin .daily-checkin-feature-rewards .daily-checkin-reward {
  width: 100%;
  min-width: 0;
  height: clamp(21px, 2.85cqh, 25px);
  padding: 2px 4px;
  display: grid !important;
  grid-template-columns: clamp(17px, 4.9cqw, 21px) auto;
  align-items: center;
  justify-content: center;
  gap: 4px !important;
  overflow: hidden;
  border: 1px solid rgba(181, 119, 38, 0.48);
  border-radius: 5px;
  background: linear-gradient(180deg, #fff5d1, #f1c97e);
  box-shadow: inset 0 1px rgba(255, 255, 222, 0.72), 0 1px 0 rgba(120, 64, 17, 0.18);
  box-sizing: border-box;
}

#modal-daily-checkin .daily-checkin-day.claimed b .daily-checkin-reward {
  border-color: rgba(210, 239, 127, 0.66);
  background: linear-gradient(180deg, rgba(83, 142, 50, 0.96), rgba(43, 91, 31, 0.96));
}

#modal-daily-checkin .daily-checkin-day.bonus b .daily-checkin-reward {
  grid-template-columns: 16px minmax(0, auto);
  gap: 2px !important;
  padding-inline: 2px;
}

#modal-daily-checkin .daily-checkin-day.bonus b .daily-checkin-reward-icon {
  width: 16px;
  height: 16px;
}

#modal-daily-checkin .daily-checkin-day.bonus b .daily-checkin-reward-value {
  font-size: clamp(0.6rem, 1.42cqh, 0.72rem);
}

#modal-daily-checkin .daily-checkin-reward-icon {
  width: clamp(17px, 4.9cqw, 21px);
  height: clamp(17px, 4.9cqw, 21px);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #145b87;
  box-shadow: none;
  box-sizing: border-box;
}

#modal-daily-checkin .daily-checkin-reward-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

#modal-daily-checkin .daily-checkin-reward-icon--xp {
  border: 0;
  border-radius: 0;
  background: linear-gradient(180deg, #ffed73, #e79c1c);
  clip-path: polygon(50% 0, 61% 34%, 98% 35%, 68% 57%, 79% 94%, 50% 72%, 21% 94%, 32% 57%, 2% 35%, 39% 34%);
  color: #155e91;
  font: 900 clamp(5px, 1.4cqw, 7px)/clamp(17px, 4.9cqw, 21px) var(--okey-font-data);
  text-shadow: 0 1px #fff3a5;
}

#modal-daily-checkin .daily-checkin-reward-icon .okey-ui-icon {
  width: clamp(11px, 3cqw, 14px);
  height: clamp(11px, 3cqw, 14px);
  fill: none;
  stroke: #7a481c;
  stroke-width: 2;
}

#modal-daily-checkin .daily-checkin-reward--diamonds .okey-ui-icon {
  stroke: #0d638f;
}

#modal-daily-checkin .daily-checkin-reward-value {
  min-width: 0;
  overflow: hidden;
  color: #4a2917;
  font-size: clamp(0.72rem, 1.72cqh, 0.88rem);
  font-weight: 900;
  line-height: 1;
  text-align: left;
  text-overflow: ellipsis;
  text-shadow: 0 1px rgba(255, 246, 205, 0.75);
  white-space: nowrap;
}

#modal-daily-checkin .daily-checkin-day.claimed .daily-checkin-reward-value {
  color: #fffbd0;
  text-shadow: 0 1px #2d5f24;
}

#modal-daily-checkin .daily-checkin-status {
  position: relative;
  z-index: 4;
  width: calc(100% - 2px);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: 2px 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #9b4c0d;
  border-radius: 4px;
  background: linear-gradient(180deg, #ffe46d, #df8b14);
  box-shadow: inset 0 1px rgba(255, 251, 188, 0.7), 0 2px 0 rgba(93, 43, 8, 0.3);
  color: #fff9ca !important;
  font-family: var(--okey-font-ui);
  font-size: clamp(0.62rem, 1.48cqh, 0.76rem);
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 1px #8a400c;
  white-space: nowrap;
  box-sizing: border-box;
}

#modal-daily-checkin .daily-checkin-day.bonus .daily-checkin-status {
  position: absolute;
  z-index: 5;
  right: 7px;
  bottom: 7px;
  width: auto;
  height: clamp(20px, 2.7cqh, 24px);
  padding-inline: 7px;
}

#modal-daily-checkin .daily-checkin-day.claimed .daily-checkin-status {
  border-color: #c9e67d;
  background: linear-gradient(180deg, #6ca83e, #376b2a);
  text-shadow: 0 1px #315f26;
}

#modal-daily-checkin .daily-checkin-status.is-empty {
  visibility: hidden;
}

#modal-daily-checkin .daily-checkin-feature {
  position: relative;
  z-index: 2;
  min-height: 0;
  padding: 0.75cqh 12px;
  display: grid;
  grid-template-columns: 38.5% minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: center;
  justify-items: stretch;
  gap: 9px;
  overflow: hidden;
  border: 3px solid #7a4010;
  border-radius: 3px;
  background:
    radial-gradient(circle at 7px 7px, #db9e38 0 2px, #68300d 3px 4px, transparent 5px),
    radial-gradient(circle at calc(100% - 7px) 7px, #db9e38 0 2px, #68300d 3px 4px, transparent 5px),
    repeating-linear-gradient(90deg, rgba(127, 67, 18, 0.045) 0 1px, transparent 1px 15px),
    linear-gradient(180deg, rgba(255, 239, 184, 0.99), rgba(235, 185, 92, 0.99));
  box-shadow:
    inset 0 0 0 2px rgba(255, 247, 201, 0.78),
    inset 0 -5px rgba(119, 55, 13, 0.12);
  box-sizing: border-box;
}

#modal-daily-checkin .daily-checkin-feature::before,
#modal-daily-checkin .daily-checkin-feature::after {
  content: none;
}

#modal-daily-checkin .daily-checkin-feature-glow {
  z-index: 0;
  inset: -20px auto -20px -6px;
  width: 155px;
  opacity: 0.5;
}

#modal-daily-checkin .daily-checkin-feature-glow::after {
  content: none;
}

#modal-daily-checkin .daily-checkin-feature-chest,
#modal-daily-checkin .daily-checkin-feature-chest.opened {
  position: relative;
  z-index: 1;
  align-self: center;
  width: 100%;
  max-width: clamp(122px, 34cqw, 148px);
  height: 15.4cqh;
  margin: 0;
  object-fit: contain;
  filter:
    drop-shadow(0 4px 0 rgba(68, 34, 10, 0.36))
    drop-shadow(0 7px 5px rgba(63, 31, 9, 0.22));
  transform: translateX(-17px) scale(1.15);
  transform-origin: left center;
}

#modal-daily-checkin .daily-checkin-feature-copy {
  position: relative;
  z-index: 2;
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: clamp(22px, 2.9cqh, 26px) clamp(28px, 3.7cqh, 33px) minmax(42px, 5.9cqh);
  align-content: center;
  gap: 0.65cqh;
}

#modal-daily-checkin .daily-checkin-feature-copy h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #71340f !important;
  font-family: var(--okey-font-ui);
  font-size: clamp(1.08rem, 2.35cqh, 1.32rem);
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px #fff1b9 !important;
  white-space: nowrap;
}

#modal-daily-checkin .daily-checkin-feature-copy h3::before,
#modal-daily-checkin .daily-checkin-feature-copy h3::after {
  content: "";
  flex: 1 1 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, #b66b1d);
}

#modal-daily-checkin .daily-checkin-feature-copy h3::after {
  background: linear-gradient(90deg, #b66b1d, transparent);
}

#modal-daily-checkin .daily-checkin-feature-rewards {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
  gap: 7px;
}

#modal-daily-checkin .daily-checkin-feature-rewards .daily-checkin-reward {
  grid-template-columns: clamp(20px, 5.7cqw, 25px) auto;
  height: 100%;
  padding-inline: 7px;
  border-color: #c98931;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff5cf, #efc576);
}

#modal-daily-checkin .daily-checkin-feature-rewards .daily-checkin-reward-icon {
  width: clamp(20px, 5.7cqw, 25px);
  height: clamp(20px, 5.7cqw, 25px);
}

#modal-daily-checkin .daily-checkin-feature-rewards .daily-checkin-reward-value {
  font-size: clamp(0.78rem, 1.85cqh, 1rem);
}

#modal-daily-checkin .daily-checkin-hint {
  display: none !important;
}

#modal-daily-checkin .daily-checkin-actions {
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

#modal-daily-checkin .daily-checkin-claim {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 4px 12px !important;
  border-width: 4px !important;
  font-size: clamp(1.16rem, 2.7cqh, 1.52rem) !important;
}

#modal-daily-checkin .daily-checkin-claim::before,
#modal-daily-checkin .daily-checkin-claim::after {
  width: 7px;
  height: 7px;
}

#modal-daily-checkin .daily-checkin-note {
  position: relative;
  z-index: 5;
  flex: 0 0 3.4cqh;
  width: 74%;
  min-height: 0;
  margin: 0.7cqh auto 0;
  padding: 0 24px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 3px solid #6b300d;
  border-radius: 2px;
  background:
    linear-gradient(90deg, #c37a29, #ffdaa0 8%, #ffe7b2 50%, #ffdaa0 92%, #c37a29);
  box-shadow:
    inset 0 0 0 2px #fff0bd,
    0 3px 0 #3b1907,
    0 6px 8px rgba(49, 25, 8, 0.28);
  clip-path: polygon(0 50%, 5% 0, 95% 0, 100% 50%, 95% 100%, 5% 100%);
  color: #6b310f !important;
  font-size: clamp(0.74rem, 1.7cqh, 0.9rem) !important;
  line-height: 1 !important;
  letter-spacing: 0.03em;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 1px #fff0b7;
  white-space: nowrap;
  box-sizing: border-box;
}

#modal-daily-checkin .daily-checkin-note::before,
#modal-daily-checkin .daily-checkin-note::after {
  content: "◆";
  margin: 0 7px;
  color: #a15b18;
  font-size: 0.55em;
}

html:lang(en) #modal-daily-checkin .daily-checkin-day-label,
html:lang(en) #modal-daily-checkin .daily-checkin-status {
  padding-inline: 2px;
  font-size: clamp(0.5rem, 1.12cqh, 0.6rem);
}

html:lang(en) #modal-daily-checkin .daily-checkin-note {
  font-size: clamp(0.54rem, 1.2cqh, 0.66rem) !important;
}

@container okey-stage (max-width: 360px) {
  #modal-daily-checkin .daily-checkin-header {
    width: 78%;
    margin-left: 7.5%;
  }

  #modal-daily-checkin .daily-checkin-close {
    right: 2.5% !important;
  }

  #modal-daily-checkin .daily-checkin-progress {
    width: 92%;
  }

  #modal-daily-checkin .daily-checkin-board {
    width: 99%;
    padding-inline: 10px;
  }

  #modal-daily-checkin .daily-checkin-grid {
    gap: 5px !important;
  }

  #modal-daily-checkin .daily-checkin-day,
#modal-daily-checkin .daily-checkin-day.today {
    padding-inline: 3px !important;
  }

  #modal-daily-checkin .daily-checkin-day-label,
#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-label {
    padding-inline: 2px;
  }

  #modal-daily-checkin .daily-checkin-day b .daily-checkin-reward {
    grid-template-columns: 15px auto;
    gap: 2px !important;
    padding-inline: 2px;
  }

  #modal-daily-checkin .daily-checkin-reward-icon {
    width: 15px;
    height: 15px;
  }

  #modal-daily-checkin .daily-checkin-feature {
    grid-template-columns: minmax(108px, 36%) minmax(0, 1fr);
    padding-inline: 8px;
    gap: 6px;
  }

  #modal-daily-checkin .daily-checkin-feature-rewards {
    gap: 4px;
  }

  #modal-daily-checkin .daily-checkin-feature-rewards .daily-checkin-reward {
    padding-inline: 3px;
  }

  #modal-daily-checkin .daily-checkin-note {
    width: 79%;
    padding-inline: 18px;
  }
}

@container okey-stage (max-height: 640px) {
  #modal-daily-checkin .daily-checkin-header h2 {
    font-size: 1.65rem !important;
  }

  #modal-daily-checkin .daily-checkin-subtitle {
    font-size: 0.6rem !important;
  }

  #modal-daily-checkin .daily-checkin-streak {
    font-size: 0.58rem;
  }

  #modal-daily-checkin .daily-checkin-day-label,
#modal-daily-checkin .daily-checkin-day.today .daily-checkin-day-label {
    font-size: 0.56rem;
  }

  #modal-daily-checkin .daily-checkin-day b .daily-checkin-reward {
    height: 19px;
  }

  #modal-daily-checkin .daily-checkin-reward-value {
    font-size: 0.56rem;
  }

  #modal-daily-checkin .daily-checkin-status {
    font-size: 0.46rem;
  }

  #modal-daily-checkin .daily-checkin-feature-copy h3 {
    font-size: 0.84rem;
  }

  #modal-daily-checkin .daily-checkin-feature-rewards .daily-checkin-reward-value {
    font-size: 0.7rem;
  }

  #modal-daily-checkin .daily-checkin-claim {
    font-size: 0.92rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #modal-daily-checkin .okey-game-modal-card {
    transition: opacity 120ms linear !important;
    transform: none !important;
  }

  #modal-daily-checkin .daily-checkin-close-art {
    transition: none !important;
  }

}

/* Mobile WebView rendering budget ---------------------------------------
 * The barracks can show 38 cards at once. Applying a full-size material
 * texture plus CSS filters to every card forces Android WebView to allocate
 * dozens of off-screen compositor surfaces. Keep the generated raster frame,
 * but avoid filters and defer cards that are outside the viewport.
 */
@container okey-stage (max-width: 520px) {
  .modal-overlay,
.okey-game-modal-overlay,
.bb-catalog-toolbar {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .bb-catalog-card {
    background: transparent !important;
    background-image: none !important;
    content-visibility: auto;
    contain-intrinsic-size: 170px 255px;
    filter: none !important;
  }

  .bb-catalog-card::before,
.bb-catalog-card.is-equipped::before,
.bb-catalog-card.is-locked::before,
.bb-catalog-card.is-locked .bb-catalog-art .bb-unit-portrait-shell,
.bb-catalog-card.is-locked .bb-catalog-art .bb-unit-sprite,
.battle-codex-card.locked,
.battle-codex-stage-row.locked,
.battle-codex-detail-layout.is-barracks-unit.is-locked .battle-codex-detail-art {
    filter: none !important;
  }

  .bb-catalog-card.is-locked .bb-catalog-art {
    opacity: 0.58;
  }

  [data-okey-ui="button"][data-okey-variant="icon"],
[data-okey-ui="button"][data-okey-variant="nav"],
[data-okey-ui="button"][data-okey-button-variant="icon"],
[data-okey-ui="button"][data-okey-button-variant="nav"],
[data-okey-ui="button"][data-okey-state~="active"],
[data-okey-ui="button"][data-okey-state~="selected"],
[data-okey-ui-role="tab"][data-okey-state~="active"],
[data-okey-ui="button"][data-okey-state~="disabled"],
[data-okey-ui="card"][data-okey-state~="locked"] {
    filter: none !important;
  }
}

@container okey-stage (min-width: 1000px) {
  .home-screen-content.lobby .lobby-topbar,
.home-screen-content.lobby .lobby-bottomnav,
.battle-map-topbar,
.battle-map-bottomnav {
    padding-inline: max(24px, calc((100cqw - 1320px) / 2)) !important;
  }

  .battle-barracks-panel,
.battle-tech-panel,
.battle-codex-panel {
    padding-inline: max(24px, calc((100cqw - 1380px) / 2));
  }

  .modal-card:not(.battle-codex-detail-card):not(.battle-tech-detail-card) {
    max-width: min(680px, 82cqw);
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-okey-ui="button"],
[data-okey-ui="panel"],
[data-okey-ui="card"] {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* Formation Room home ---------------------------------------------------
 * The v1 concept is a portrait composition. The canvas remains centered on
 * wide screens, while mobile devices use the whole viewport. Controls stay
 * live HTML above the reference composition so navigation and save-backed
 * values continue to work.
 */
#home-screen-content.lobby[data-okey-home="formation-room"] {
  --okey-home-canvas-width: min(100cqw, calc(100cqh * 0.5556));
  background-color: #061814 !important;
  background-image: url(assets/home/v1-formation-room-home.webp?v=1) !important;
  background-blend-mode: normal !important;
  background-position: center top !important;
  background-repeat: no-repeat !important;
  background-size: var(--okey-home-canvas-width) 100% !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"]::before {
  display: block;
  inset: 0 auto 0 50%;
  width: var(--okey-home-canvas-width);
  transform: translateX(-50%);
  background: linear-gradient(90deg, rgba(2, 12, 10, 0.12), transparent 4% 96%, rgba(2, 12, 10, 0.12));
  box-shadow: 0 0 38px rgba(0, 0, 0, 0.72);
  opacity: 1;
  filter: none;
  z-index: 0;
}

@container okey-stage (max-width: 520px) {
  #home-screen-content.lobby[data-okey-home="formation-room"] {
    background-image: url(assets/home/v1-formation-room-home-mobile.webp?v=1) !important;
  }
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-topbar,
#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-pages,
#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-bottomnav {
  left: 50%;
  right: auto;
  width: var(--okey-home-canvas-width);
  transform: translateX(-50%);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-topbar {
  top: 0.55cqh;
  height: clamp(52px, 7.6cqh, 82px);
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 41fr) minmax(0, 44fr) minmax(42px, 9fr);
  align-items: stretch;
  gap: 1.25%;
  padding: 0 1.4%;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  opacity: 1;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-block {
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 100%;
  padding: 3.5% 4% 3.5% 0;
  gap: 0;
  border: 0 !important;
  border-radius: 0;
  background: none !important;
  box-shadow: none !important;
  filter: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar {
  width: 35%;
  height: 100%;
  flex: 0 0 35%;
  border: 0;
  background: none;
  box-shadow: none;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-face {
  display: none;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-lvl {
  left: 98%;
  right: auto;
  top: 86%;
  bottom: auto;
  min-width: clamp(24px, 3.8cqh, 40px);
  height: clamp(24px, 3.8cqh, 40px);
  padding: 0 4px;
  border: 2px solid #5a3614;
  border-radius: 50%;
  background: linear-gradient(180deg, #d6a52f, #8e5816);
  color: #fff4c7;
  font-family: var(--okey-font-display) !important;
  font-size: clamp(0.65rem, 1.55cqh, 0.95rem);
  transform: translate(-50%, -50%);
  box-shadow: inset 0 0 0 2px #f1ce6c, 0 2px 4px rgba(0, 0, 0, 0.72);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-meta {
  flex: 1 1 auto;
  align-self: center;
  min-width: 0;
  gap: 2px;
  padding: 3% 5%;
  border: 0;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(18, 52, 44, 0.99), rgba(7, 29, 24, 0.99));
  box-shadow: none;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-pname {
  max-width: 100%;
  color: #f7e8bd;
  font-family: var(--okey-font-ui) !important;
  font-size: clamp(0.72rem, 2.05cqh, 1.16rem);
  line-height: 1;
  text-shadow: 0 2px 1px #2a160d;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-xpbar {
  display: none;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-xptext {
  max-width: 100%;
  color: #f5d99a;
  font-family: var(--okey-font-data) !important;
  font-size: clamp(0.44rem, 1.05cqh, 0.64rem);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-resources {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4%;
  margin: 0;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .res-pill {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .res-ico {
  display: none;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .res-val {
  position: absolute;
  left: 31%;
  top: 50%;
  width: 42%;
  min-width: 0;
  padding: 2px 3px;
  transform: translateY(-50%);
  border-radius: 5px;
  background: #09231e;
  color: #f7e8bd;
  font-family: var(--okey-font-display) !important;
  font-size: clamp(0.52rem, 1.3cqh, 0.8rem);
  line-height: 1.25;
  text-align: center;
  text-shadow: 0 2px 1px #23150d;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .res-plus {
  position: absolute;
  right: 5%;
  top: 15%;
  width: 27%;
  height: 70%;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  color: transparent !important;
  filter: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-gear {
  width: 100%;
  height: 100%;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  filter: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-gear svg {
  opacity: 0;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-pages {
  top: 0;
  bottom: 0;
}

#home-screen-content.lobby[data-okey-home="formation-room"] #page-journey,
#home-screen-content.lobby[data-okey-home="formation-room"] #page-journey .lobby-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  opacity: 1;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-logo,
#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-character {
  display: none;
}

#home-screen-content.lobby[data-okey-home="formation-room"] #page-journey .lobby-play {
  position: absolute;
  left: 50%;
  top: 63.6%;
  width: 47%;
  height: 16.8%;
  margin: 0;
  transform: translateX(-50%);
  z-index: 3;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn {
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0 !important;
  border-radius: 50%;
  background: none !important;
  box-shadow: none !important;
  animation: none;
  filter: none !important;
  overflow: hidden;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn::before {
  display: block !important;
  inset: 5% 5% 6%;
  z-index: 0;
  border-radius: 44% / 38%;
  background-color: #0c3b31 !important;
  background-image: var(--okey-v1-art-button-primary) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 112% 128% !important;
  opacity: 0.98 !important;
  filter: brightness(1.28) saturate(1.08);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn::after {
  display: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn svg {
  display: none;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn span {
  position: relative;
  z-index: 1;
  display: block;
  width: 5.3ch;
  color: #f0c96b !important;
  font-family: var(--okey-font-display) !important;
  font-size: clamp(1.3rem, 3.2cqh, 2.1rem);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: 0.02em;
  text-align: center;
  -webkit-text-stroke: 0.35px #704010;
  text-shadow: 0 2px 0 #553011, 0 4px 6px rgba(0, 0, 0, 0.7) !important;
}

:lang(zh) #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn span {
  width: auto;
  font-size: clamp(1.25rem, 2.8cqh, 1.9rem);
  letter-spacing: 0.08em;
}

:lang(en) #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn::before {
  display: none !important;
}

:lang(en) #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn span,
:lang(en) #home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-title,
:lang(en) #home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-label,
:lang(en) #home-screen-content.lobby[data-okey-home="formation-room"] .nav-label {
  opacity: 0;
}

#home-screen-content.lobby[data-okey-home="formation-room"] #page-journey .lobby-side-rail {
  left: 1.4%;
  top: 73.8%;
  width: 19.5%;
  height: 15.1%;
  transform: none;
  opacity: 1;
  z-index: 4;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: none !important;
  box-shadow: none !important;
  filter: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-emoji {
  display: none;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-title {
  position: absolute;
  left: 0;
  right: 0;
  top: 63%;
  padding: 4% 1%;
  border-radius: 4px;
  background-color: #0b3a2f;
  background-image: var(--okey-v1-art-button-primary);
  background-position: center;
  background-size: 100% 100%;
  color: #f0c96b !important;
  font-family: var(--okey-font-display) !important;
  font-size: clamp(0.42rem, 1.18cqh, 0.68rem);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 0 #472b14;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-label {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: 4%;
  padding: 4% 2%;
  border-radius: 5px;
  background-color: #0b3a2f;
  background-image: var(--okey-v1-art-button-primary);
  background-position: center;
  background-size: 100% 100%;
  color: #f0c96b !important;
  font-family: var(--okey-font-display) !important;
  font-size: clamp(0.5rem, 1.45cqh, 0.8rem);
  line-height: 1;
  text-shadow: 0 1px 0 #472b14;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-dot[hidden] {
  display: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-bottomnav {
  bottom: 0;
  height: 10.8%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 3.5%;
  padding: 1.25% 4.2% max(1.2%, var(--okey-safe-bottom));
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  opacity: 1;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab {
  width: 100%;
  min-height: 0;
  height: 100%;
  margin: 0 !important;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: none !important;
  box-shadow: none !important;
  filter: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .nav-emoji {
  display: none;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .nav-label {
  width: 62%;
  margin-left: 24%;
  padding: 1% 3%;
  border-radius: 5px;
  background-color: #0b3b31;
  background-image: var(--okey-v1-art-button-primary);
  background-position: center;
  background-size: 100% 100%;
  color: #f0c96b !important;
  font-family: var(--okey-font-display) !important;
  font-size: clamp(1rem, 3cqh, 1.75rem) !important;
  font-weight: 700;
  line-height: 1;
  transform: translateY(100%);
  text-shadow: 0 2px 0 #513016, 0 3px 5px rgba(0, 0, 0, 0.72);
}

:lang(zh) #home-screen-content.lobby[data-okey-home="formation-room"] .nav-label {
  letter-spacing: 0.08em;
}

@container okey-stage (min-width: 900px) {
  #home-screen-content.lobby[data-okey-home="formation-room"] {
    background-color: #03100d !important;
  }
}

/* Formation Room home v2 ------------------------------------------------
 * The raster layer is scenery only. Every interactive control below is live
 * HTML with its own material, state, focus ring, localized label, and hit box.
 */
#home-screen-content.lobby[data-okey-home="formation-room"] {
  --okey-home-canvas-width: min(100cqw, 620px, calc(100cqh * 0.7));
  --okey-home-topbar-height: clamp(62px, 8.4cqh, 78px);
  --okey-home-nav-height: clamp(72px, 10.4cqh, 92px);
  background-color: #061814 !important;
  background-image:
    linear-gradient(rgba(3, 16, 13, 0.42), rgba(3, 16, 13, 0.68)),
    url(assets/home/v2-formation-room-scene.webp?v=2) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"]::before {
  display: block;
  content: "";
  position: absolute;
  inset: 0 auto 0 50%;
  width: var(--okey-home-canvas-width);
  height: 100%;
  transform: translateX(-50%);
  background-image: url(assets/home/v2-formation-room-scene.webp?v=2);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  box-shadow: 0 0 48px rgba(0, 0, 0, 0.7);
  opacity: 1;
  filter: none;
  z-index: 0;
}

#home-screen-content.lobby[data-okey-home="formation-room"]::after {
  display: block;
  content: "";
  position: absolute;
  inset: 0 auto 0 50%;
  width: var(--okey-home-canvas-width);
  transform: translateX(-50%);
  background:
    linear-gradient(180deg, rgba(2, 13, 11, 0.38) 0%, transparent 16% 72%, rgba(2, 13, 11, 0.6) 100%),
    linear-gradient(90deg, rgba(2, 12, 10, 0.2), transparent 5% 95%, rgba(2, 12, 10, 0.2));
  pointer-events: none;
  z-index: 1;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-topbar,
#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-pages,
#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-bottomnav {
  left: 50%;
  right: auto;
  width: var(--okey-home-canvas-width);
  transform: translateX(-50%);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-topbar {
  top: max(6px, var(--okey-safe-top));
  height: var(--okey-home-topbar-height);
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(122px, 1.25fr) minmax(150px, 1fr) clamp(46px, 12%, 58px);
  align-items: stretch;
  gap: clamp(5px, 1.2cqw, 9px);
  padding: 0 clamp(7px, 1.8cqw, 12px);
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  opacity: 1;
  z-index: 12;
}

#home-screen-content.lobby[data-okey-home="formation-room"] [data-okey-home-control] {
  position: relative;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .okey-home-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .okey-ui-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: #f6d77d;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.62));
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-block {
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px 7px 7px;
  border: 0 !important;
  border-radius: 12px;
  background-color: #0d2540 !important;
  background-image: var(--okey-v1-art-button-info) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  box-shadow: var(--okey-v1-shadow-control) !important;
  filter: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar {
  width: clamp(40px, 6.2cqh, 54px);
  height: clamp(40px, 6.2cqh, 54px);
  flex: 0 0 clamp(40px, 6.2cqh, 54px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--okey-v1-gold);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #6fbcff, #224f8f 72%);
  box-shadow: inset 0 0 0 2px rgba(255, 244, 199, 0.28), 0 3px 8px rgba(0, 0, 0, 0.5);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-face {
  display: block;
  width: clamp(24px, 3.8cqh, 32px);
  height: clamp(24px, 3.8cqh, 32px);
  color: #fff0b4;
  stroke-width: 1.65;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-lvl {
  left: auto;
  right: -5px;
  top: auto;
  bottom: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  transform: none;
  border: 1px solid #4c2b12;
  border-radius: 50%;
  background: linear-gradient(180deg, #e0b34a, #8b5318);
  color: #fff5c8;
  font-size: 0.68rem;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-meta {
  min-width: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 3px;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-pname {
  max-width: 100%;
  overflow: hidden;
  color: #fff2c7;
  font-family: var(--okey-font-ui) !important;
  font-size: clamp(0.72rem, 1.7cqh, 0.92rem);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-xpbar {
  display: block;
  width: 100%;
  max-width: 110px;
  height: 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-xptext {
  max-width: 100%;
  overflow: hidden;
  color: #f1d797;
  font-family: var(--okey-font-data) !important;
  font-size: clamp(0.48rem, 1.05cqh, 0.62rem);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-resources {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin: 0;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .res-pill {
  width: 100%;
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 22px minmax(18px, 1fr) 24px;
  align-items: center;
  gap: 2px;
  padding: 7px 5px;
  border: 0 !important;
  border-radius: 11px;
  background-color: #19351f !important;
  background-image: var(--okey-v1-art-button-primary) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  box-shadow: var(--okey-v1-shadow-control) !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .res-ico {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  color: #ffe083;
  stroke-width: 1.9;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .res-val {
  position: static;
  width: auto;
  min-width: 0;
  padding: 0;
  transform: none;
  border-radius: 0;
  background: none;
  color: #fff1bd;
  font-family: var(--okey-font-data) !important;
  font-size: clamp(0.66rem, 1.55cqh, 0.84rem);
  text-align: center;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .res-plus {
  position: static;
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  border: 0 !important;
  border-radius: 8px;
  background-color: #0d2540 !important;
  background-image: var(--okey-v1-art-button-info) !important;
  background-position: center !important;
  background-size: 100% 100% !important;
  color: #fff1bd !important;
  font-size: 0.9rem;
  box-shadow: 0 2px 0 rgba(20, 10, 7, 0.8) !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-gear {
  width: 100%;
  height: 100%;
  min-width: 46px;
  padding: 0;
  border: 0 !important;
  border-radius: 12px;
  background-color: #0d2540 !important;
  background-image: var(--okey-v1-art-button-info) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  color: #fff1bd;
  box-shadow: var(--okey-v1-shadow-control) !important;
  filter: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-gear svg {
  opacity: 1;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-pages {
  top: calc(var(--okey-home-topbar-height) + max(12px, var(--okey-safe-top)));
  bottom: calc(var(--okey-home-nav-height) + var(--okey-safe-bottom));
  height: auto;
  overflow: hidden;
  z-index: 3;
}

#home-screen-content.lobby[data-okey-home="formation-room"] #page-journey,
#home-screen-content.lobby[data-okey-home="formation-room"] #page-journey .lobby-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  opacity: 1;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-logo {
  position: absolute;
  top: 2.5%;
  left: 50%;
  display: block;
  margin: 0;
  transform: translateX(-50%);
  color: #f4dda0 !important;
  font-family: var(--okey-font-display) !important;
  font-size: clamp(2.25rem, 7.2cqh, 4rem);
  letter-spacing: 0.03em;
  line-height: 1;
  text-shadow: 0 3px 0 #593616, 0 0 4px #f6d778, 0 8px 18px rgba(0, 0, 0, 0.72) !important;
  pointer-events: none;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-character {
  display: none;
}

#home-screen-content.lobby[data-okey-home="formation-room"] #page-journey .lobby-play {
  position: absolute;
  left: 50%;
  bottom: 4%;
  width: min(62%, 330px);
  height: auto;
  margin: 0;
  transform: translateX(-50%);
  z-index: 4;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn {
  width: 100%;
  min-width: 0;
  height: clamp(58px, 8.4cqh, 76px);
  min-height: clamp(58px, 8.4cqh, 76px);
  padding: 12px 28px;
  border: 0 !important;
  border-radius: 18px;
  background-color: #19351f !important;
  background-image: var(--okey-v1-art-button-primary) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  color: #ffe9a6 !important;
  box-shadow: 0 6px 0 rgba(27, 13, 8, 0.88), 0 12px 24px rgba(0, 0, 0, 0.5) !important;
  animation: none;
  filter: none !important;
  overflow: visible;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn::before,
#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn::after {
  display: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn svg {
  display: block;
  flex: 0 0 auto;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn span {
  position: static;
  display: block;
  width: auto;
  color: #ffe9a6 !important;
  font-family: var(--okey-font-display) !important;
  font-size: clamp(1.2rem, 3cqh, 1.75rem);
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 0 #553011, 0 4px 7px rgba(0, 0, 0, 0.75) !important;
  opacity: 1;
}

#home-screen-content.lobby[data-okey-home="formation-room"] #page-journey .lobby-side-rail {
  position: absolute;
  left: 2.5%;
  top: auto;
  bottom: 3%;
  width: clamp(72px, 19%, 108px);
  height: auto;
  transform: none;
  opacity: 1;
  z-index: 5;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin {
  width: 100%;
  min-height: clamp(62px, 8.8cqh, 78px);
  display: grid;
  grid-template-columns: 28px 1fr;
  grid-template-areas: "icon title" "icon label";
  align-items: center;
  gap: 0 4px;
  padding: 9px 8px;
  border: 0 !important;
  border-radius: 13px;
  background-color: #49131b !important;
  background-image: var(--okey-v1-art-button-danger) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  color: #ffe9a6 !important;
  box-shadow: var(--okey-v1-shadow-control) !important;
  filter: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-emoji {
  grid-area: icon;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 34px;
  border: 0;
  background: none;
  box-shadow: none;
  color: #ffe39a;
  stroke-width: 1.8;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-title,
#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-label {
  position: static;
  inset: auto;
  padding: 0;
  border-radius: 0;
  background: none;
  color: #ffe9a6 !important;
  font-family: var(--okey-font-ui) !important;
  line-height: 1.05;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.82);
  opacity: 1;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-title {
  grid-area: title;
  font-size: clamp(0.56rem, 1.25cqh, 0.72rem);
  font-weight: 700;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-label {
  grid-area: label;
  font-size: clamp(0.62rem, 1.5cqh, 0.82rem);
  font-weight: 700;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-dot {
  right: 5px;
  top: 5px;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-bottomnav {
  bottom: 0;
  height: var(--okey-home-nav-height);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: clamp(6px, 1.8cqw, 12px);
  padding: 9px clamp(10px, 2.5cqw, 18px) max(9px, var(--okey-safe-bottom));
  border: 0 !important;
  background-color: rgba(26, 18, 14, 0.96) !important;
  background-image: var(--okey-v1-art-hud) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.42) !important;
  opacity: 1;
  z-index: 12;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab {
  width: 100%;
  min-height: 0;
  height: 100%;
  margin: 0 !important;
  padding: 7px 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0 !important;
  border-radius: 13px;
  background-color: #0d2540 !important;
  background-image: var(--okey-v1-art-button-info) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  color: #fff1bd !important;
  box-shadow: 0 4px 0 rgba(20, 10, 7, 0.82), 0 7px 12px rgba(0, 0, 0, 0.35) !important;
  filter: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab[data-page="journey"] {
  min-height: 0;
  margin: 0 !important;
  background-color: #19351f !important;
  background-image: var(--okey-v1-art-button-primary) !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .nav-emoji {
  display: inline-flex;
  width: clamp(22px, 3.2cqh, 28px);
  height: clamp(22px, 3.2cqh, 28px);
  color: #ffe39a;
  stroke-width: 1.8;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.55));
}

#home-screen-content.lobby[data-okey-home="formation-room"] .nav-label {
  width: auto;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: none;
  color: #fff1bd !important;
  font-family: var(--okey-font-ui) !important;
  font-size: clamp(0.82rem, 2.05cqh, 1.05rem) !important;
  font-weight: 700;
  line-height: 1;
  transform: none;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.72);
  opacity: 1;
}

:lang(en) #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn span,
:lang(en) #home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-title,
:lang(en) #home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-label,
:lang(en) #home-screen-content.lobby[data-okey-home="formation-room"] .nav-label {
  opacity: 1;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-page-scroll {
  padding: 12px 0 20px;
  background: var(--okey-lobby-page-background, linear-gradient(180deg, rgba(5, 25, 19, 0.88), rgba(3, 17, 13, 0.96)));
  scrollbar-color: var(--okey-v1-gold-deep) transparent;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .page-store-inner {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 clamp(12px, 3cqw, 20px) 28px;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .page-title {
  margin: 4px 0 14px;
  font-size: clamp(1.4rem, 4cqh, 2rem);
  line-height: 1.15;
}

@container okey-stage (max-width: 520px) {
  #home-screen-content.lobby[data-okey-home="formation-room"] {
    --okey-home-canvas-width: 100cqw;
    --okey-home-topbar-height: clamp(58px, 8.2cqh, 70px);
    --okey-home-nav-height: clamp(68px, 9.8cqh, 82px);
    background-image:
      linear-gradient(rgba(3, 16, 13, 0.4), rgba(3, 16, 13, 0.64)),
      url(assets/home/v2-formation-room-scene-mobile.webp?v=2) !important;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"]::before {
    background-image: url(assets/home/v2-formation-room-scene-mobile.webp?v=2);
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-topbar {
    grid-template-columns: minmax(112px, 1.15fr) minmax(132px, 1fr) 44px;
    gap: 4px;
    padding-inline: max(5px, var(--okey-safe-left));
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-block {
    padding: 6px 8px 6px 5px;
    gap: 5px;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .res-pill {
    grid-template-columns: 18px minmax(16px, 1fr) 20px;
    padding: 6px 3px;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .res-plus {
    width: 20px;
    min-width: 20px;
    height: 22px;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-logo {
    top: 3%;
    font-size: clamp(2rem, 6.2cqh, 3.15rem);
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] #page-journey .lobby-play {
    bottom: 4%;
    width: min(64%, 280px);
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] #page-journey .lobby-side-rail {
    left: 2%;
    bottom: 3.5%;
    width: clamp(68px, 20%, 86px);
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin {
    grid-template-columns: 22px 1fr;
    min-height: 58px;
    padding: 7px 5px;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-emoji {
    width: 22px;
    font-size: 1rem;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-bottomnav {
    gap: 6px;
    padding-inline: max(7px, var(--okey-safe-left));
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab {
    gap: 5px;
    padding-inline: 6px;
  }
}

@container okey-stage (max-width: 340px) {
  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-topbar {
    grid-template-columns: minmax(102px, 1.1fr) minmax(112px, 1fr) 42px;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-face,
#home-screen-content.lobby[data-okey-home="formation-room"] .res-ico {
    display: none;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .res-pill {
    grid-template-columns: minmax(18px, 1fr) 20px;
  }
}

/* Settings polish -------------------------------------------------------
   Settings are a continuous list, not a stack of stretched button skins.
   The rows and controls below are drawn with reusable CSS materials so they
   can resize without distorting raster ornament. */

/* Fixed pixel lobby -----------------------------------------------------
 * The generated artwork is scenery only. It is always cropped with `cover`
 * so different phone aspect ratios never stretch the gate or characters.
 * Every visible label, HUD item and action remains live HTML.
 */
#home-screen-content.lobby[data-okey-home="formation-room"] {
  --okey-home-canvas-width: 100cqw;
  --okey-home-axis-x: 50%;
  --okey-home-scene-position-x: 50%;
  --okey-home-plaza-screen-y: 63.34cqh;
  --okey-home-topbar-height: clamp(68px, 8.8cqh, 82px);
  --okey-home-nav-height: clamp(96px, 12.5cqh, 116px);
  background-color: #041a24 !important;
  background-image:
    linear-gradient(180deg, rgba(2, 14, 20, 0.22), rgba(2, 14, 20, 0.04) 55%, rgba(2, 11, 14, 0.38)),
    var(--okey-home-lobby-mobile) !important;
  background-position: center center, var(--okey-home-scene-position-x) center !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"]::before {
  left: var(--okey-home-axis-x);
  width: var(--okey-home-canvas-width);
  background-image: var(--okey-home-lobby-mobile);
  background-position: var(--okey-home-scene-position-x) center;
  background-size: cover;
  box-shadow: none;
}

#home-screen-content.lobby[data-okey-home="formation-room"]::after {
  width: var(--okey-home-canvas-width);
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(1, 13, 20, 0.54) 0%, rgba(1, 13, 20, 0.08) 14%, transparent 28% 68%, rgba(1, 11, 13, 0.5) 100%),
    linear-gradient(90deg, rgba(1, 12, 17, 0.2), transparent 9% 91%, rgba(1, 12, 17, 0.2));
  box-shadow: none;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-topbar {
  grid-template-columns: minmax(320px, 420px) minmax(340px, 460px) 64px;
  justify-content: space-between;
  gap: 10px;
  padding: 0 clamp(14px, 2.4cqw, 30px);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-resources {
  height: clamp(48px, 6.6cqh, 60px);
  align-self: center;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-block,
#home-screen-content.lobby[data-okey-home="formation-room"] .res-pill,
#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-gear,
#home-screen-content.lobby[data-okey-home="formation-room"] .res-plus,
#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin,
#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab,
#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab[data-page="journey"] {
  background-image: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-block,
#home-screen-content.lobby[data-okey-home="formation-room"] .res-pill {
  border: 2px solid #b98731 !important;
  background:
    linear-gradient(180deg, rgba(24, 73, 68, 0.97), rgba(5, 33, 34, 0.98)) !important;
  box-shadow:
    inset 0 0 0 2px rgba(246, 208, 112, 0.16),
    inset 0 -8px 14px rgba(0, 0, 0, 0.2),
    0 4px 0 #4b2c13,
    0 8px 18px rgba(0, 0, 0, 0.32) !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-block {
  border-radius: 22px 8px 22px 8px;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .res-pill {
  border-radius: 999px;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .res-plus,
#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-gear {
  border: 2px solid #c7973d !important;
  background: radial-gradient(circle at 35% 28%, #315f5a, #092f31 72%) !important;
  color: #ffe8a2 !important;
  box-shadow:
    inset 0 0 0 2px rgba(255, 225, 142, 0.14),
    0 3px 0 #4b2b13,
    0 7px 14px rgba(0, 0, 0, 0.34) !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-gear {
  height: 64px;
  align-self: center;
  border-radius: 50%;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-logo {
  top: 5.5%;
  min-width: min(68%, 620px);
  padding: 0.12em 0.55em 0.18em;
  border: 3px solid #c99b42;
  border-radius: 48% 48% 24% 24% / 34% 34% 18% 18%;
  background:
    linear-gradient(180deg, rgba(21, 80, 66, 0.97), rgba(4, 42, 38, 0.98));
  color: #f9d978 !important;
  font-size: clamp(3.2rem, 8.6cqh, 6.4rem);
  text-align: center;
  text-shadow:
    0 2px 0 #fff0ae,
    0 5px 0 #744515,
    0 10px 20px rgba(0, 0, 0, 0.55) !important;
  box-shadow:
    inset 0 0 0 3px rgba(255, 224, 132, 0.18),
    0 5px 0 #4d2d13,
    0 12px 28px rgba(0, 0, 0, 0.38);
}

#home-screen-content.lobby[data-okey-home="formation-room"] #page-journey .lobby-play {
  bottom: 8%;
  width: min(54%, 430px);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn {
  min-height: clamp(70px, 9.8cqh, 92px);
  border: 3px solid #d0a34a !important;
  border-radius: 50% / 38%;
  background:
    radial-gradient(ellipse at 50% 20%, #246c55, #075044 58%, #032f2d 100%) !important;
  color: #ffe18a !important;
  box-shadow:
    inset 0 0 0 4px rgba(255, 222, 126, 0.16),
    inset 0 -12px 20px rgba(0, 0, 0, 0.24),
    0 6px 0 #5a3415,
    0 14px 28px rgba(0, 0, 0, 0.42) !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn span {
  color: #ffe18a !important;
  font-size: clamp(1.35rem, 3.3cqh, 2rem);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin {
  border: 2px solid #c79438 !important;
  border-radius: 14px 14px 22px 8px;
  background:
    linear-gradient(180deg, rgba(18, 82, 66, 0.98), rgba(4, 43, 38, 0.98)) !important;
  box-shadow:
    inset 0 0 0 2px rgba(255, 224, 130, 0.14),
    0 4px 0 #4f2e14,
    0 9px 18px rgba(0, 0, 0, 0.34) !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-bottomnav {
  gap: clamp(8px, 1.5cqw, 16px);
  padding: 10px clamp(14px, 3cqw, 34px) max(10px, var(--okey-safe-bottom));
  border-top: 3px solid #a9782e !important;
  background:
    linear-gradient(180deg, rgba(12, 57, 50, 0.98), rgba(3, 31, 31, 0.99)) !important;
  box-shadow:
    inset 0 2px 0 rgba(255, 222, 126, 0.18),
    0 -8px 24px rgba(0, 0, 0, 0.4) !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab,
#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab[data-page="journey"] {
  border: 2px solid #c28f36 !important;
  border-radius: 16px 6px 16px 6px;
  background:
    linear-gradient(180deg, rgba(27, 91, 72, 0.98), rgba(5, 50, 44, 0.98)) !important;
  box-shadow:
    inset 0 0 0 2px rgba(255, 225, 137, 0.12),
    0 4px 0 #4d2d13,
    0 8px 14px rgba(0, 0, 0, 0.3) !important;
}

@container okey-stage (max-width: 720px) {
  #home-screen-content.lobby[data-okey-home="formation-room"] {
    --okey-home-canvas-width: 100cqw;
    --okey-home-topbar-height: clamp(64px, 8.6cqh, 74px);
    --okey-home-nav-height: clamp(72px, 10.2cqh, 86px);
    background-image:
      linear-gradient(180deg, rgba(2, 14, 20, 0.2), rgba(2, 14, 20, 0.02) 58%, rgba(2, 11, 14, 0.34)),
      var(--okey-home-lobby-mobile) !important;
    background-position: center center, var(--okey-home-scene-position-x) center !important;
    background-size: cover !important;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"]::before {
    background-image: var(--okey-home-lobby-mobile);
    background-position: var(--okey-home-scene-position-x) center;
    background-size: cover;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-topbar {
    grid-template-columns: minmax(126px, 1fr) minmax(166px, 1.28fr) 44px;
    justify-content: stretch;
    gap: 4px;
    padding-inline: max(4px, var(--okey-safe-left));
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-resources {
    height: 48px;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-gear {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-block,
#home-screen-content.lobby[data-okey-home="formation-room"] .res-pill {
    border-width: 1.5px !important;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-logo {
    top: 4.5%;
    min-width: 72%;
    padding-inline: 0.38em;
    border-width: 2px;
    font-size: clamp(2.6rem, 6.8cqh, 3.6rem);
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] #page-journey .lobby-play {
    bottom: 8%;
    width: min(68%, 310px);
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn {
    min-height: clamp(64px, 8.8cqh, 78px);
    border-width: 2px !important;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] #page-journey .lobby-side-rail {
    left: 2.5%;
    bottom: 2.5%;
    width: clamp(88px, 24%, 104px);
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-bottomnav {
    gap: 7px;
    padding-inline: max(8px, var(--okey-safe-left));
  }
}

/* Generated lobby component skins --------------------------------------
 * Counters and utility controls keep live DOM labels. Named navigation,
 * start, check-in, and title controls use baked lettering while retaining
 * localized accessible names. Components with a central ornament keep their
 * natural aspect ratio; long bars stretch only their undecorated middle via
 * border-image slices.
 */
#home-screen-content.lobby[data-okey-home="formation-room"] {
  --okey-home-ui-profile: url(assets/home/ui-v3/profile-panel-v1.webp?v=1);
  --okey-home-ui-avatar: url(assets/home/ui-v3/avatar-frame-v1.webp?v=1);
  --okey-home-ui-resource: url(assets/home/ui-v3/resource-pill-v1.webp?v=1);
  --okey-home-ui-round: url(assets/home/ui-v3/round-button-v1.webp?v=1);
  --okey-home-ui-checkin: url(assets/home/ui-v3/daily-chest-checkin-en-v3.webp?v=3);
  --okey-home-ui-start: url(assets/home/ui-v3/start-game-en-v2.webp?v=2);
  --okey-home-ui-nav: url(assets/home/ui-v3/nav-button-v1.webp?v=1);
  --okey-home-ui-nav-play-en: url(assets/home/ui-v3/nav-play-en-v1.webp?v=1);
  --okey-home-ui-nav-play-zh: url(assets/home/ui-v3/nav-play-zh-v1.webp?v=1);
  --okey-home-ui-nav-store-en: url(assets/home/ui-v3/nav-store-en-v1.webp?v=1);
  --okey-home-ui-nav-store-zh: url(assets/home/ui-v3/nav-store-zh-v1.webp?v=1);
  --okey-home-ui-title: url(assets/home/ui-v3/title-okey-v1.webp?v=1);
  --okey-home-resource-cap: clamp(36px, 4.8cqh, 44px);
  --okey-home-nav-cap: clamp(52px, 7.2cqh, 68px);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-topbar {
  grid-template-columns: minmax(250px, 330px) minmax(340px, 460px) 64px;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-block {
  width: 100%;
  height: auto;
  max-height: 100%;
  aspect-ratio: 1193 / 320;
  align-self: center;
  gap: clamp(5px, 0.7cqw, 9px);
  padding: 5px 18px 5px 5px;
  border: 0 !important;
  border-radius: 0;
  background: var(--okey-home-ui-profile) center / contain no-repeat !important;
  box-shadow: none !important;
  filter: none !important;
  overflow: visible;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar {
  width: clamp(48px, 7.2cqh, 64px);
  height: clamp(48px, 7.2cqh, 64px);
  flex: 0 0 clamp(48px, 7.2cqh, 64px);
  margin-left: -5px;
  border: 0 !important;
  border-radius: 0;
  background: var(--okey-home-ui-avatar) center / contain no-repeat !important;
  box-shadow: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-face {
  width: 45%;
  height: 45%;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-lvl {
  right: 3%;
  bottom: 4%;
  min-width: clamp(13px, 1.9cqh, 17px);
  width: clamp(13px, 1.9cqh, 17px);
  height: clamp(13px, 1.9cqh, 17px);
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  font-size: clamp(0.48rem, 1cqh, 0.62rem);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .res-pill {
  grid-template-columns: var(--okey-home-resource-cap) minmax(18px, 1fr) var(--okey-home-resource-cap);
  gap: 0;
  padding: 0;
  border: 1px solid transparent !important;
  border-image-source: var(--okey-home-ui-resource) !important;
  border-image-slice: 58 230 58 230 fill !important;
  border-image-width: 10px var(--okey-home-resource-cap) !important;
  border-image-outset: 0 !important;
  border-image-repeat: stretch !important;
  border-radius: 0;
  background: none !important;
  box-shadow: none !important;
  overflow: visible;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .res-ico {
  justify-self: center;
  width: clamp(18px, 2.7cqh, 24px);
  height: clamp(18px, 2.7cqh, 24px);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .res-plus {
  position: static;
  width: 100%;
  min-width: 0;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: none !important;
  box-shadow: none !important;
  color: #ffe49a !important;
  font-size: clamp(0.92rem, 2.1cqh, 1.15rem);
  line-height: 1;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-gear {
  width: 64px;
  min-width: 64px;
  height: 64px;
  aspect-ratio: 1;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: var(--okey-home-ui-round) center / contain no-repeat !important;
  box-shadow: none !important;
  color: #f8d77d !important;
  filter: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-gear svg {
  width: 40%;
  height: 40%;
  opacity: 1;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-logo {
  top: 2%;
  left: var(--okey-home-axis-x);
  width: min(88cqw, 620px);
  min-width: 0;
  height: auto;
  aspect-ratio: 1300 / 578;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--okey-home-ui-title) center / contain no-repeat !important;
  color: transparent !important;
  font-size: 0;
  line-height: 0;
  text-shadow: none !important;
  box-shadow: none;
  transform: translateX(-50%);
}

#home-screen-content.lobby[data-okey-home="formation-room"] #page-journey .lobby-play {
  left: var(--okey-home-axis-x);
  top: calc(var(--okey-home-plaza-screen-y) - var(--okey-home-topbar-height) - max(12px, var(--okey-safe-top)));
  bottom: auto;
  width: clamp(273px, 65cqw, 507px);
  transform: translate(-50%, -50%);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn {
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: 1.8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  outline: none !important;
  /* Transparent so contain-sized oval art does not sit on a dark rectangle. */
  background-color: transparent !important;
  background-image: var(--okey-home-ui-start) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
  box-shadow: none !important;
  filter: none !important;
  overflow: visible !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn::before,
#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn::after {
  display: none !important;
  content: none !important;
  background: none !important;
  box-shadow: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] #page-journey .lobby-side-rail {
  left: 2%;
  bottom: 2%;
  width: clamp(118px, 11cqw, 170px);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin {
  position: relative;
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: 1086 / 1448;
  display: block;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: var(--okey-home-ui-checkin) center / contain no-repeat !important;
  box-shadow: none !important;
  filter: none !important;
  overflow: visible;
}

/* Classic / shared formation room: the check-in control already is a full
   chest art board ( --okey-home-ui-checkin ). Hide the pixel-only chest
   layers so they do not stack on top of the classic chest. */
#home-screen-content.lobby[data-okey-home="formation-room"] .daily-chest-object,
#home-screen-content.lobby[data-okey-home="formation-room"] .daily-chest-plaque,
#home-screen-content.lobby[data-okey-home="formation-room"] .home-pixel-icon--checkin {
  display: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-emoji {
  display: none;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-title,
#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-label {
  display: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-title {
  top: 62%;
  height: 13%;
  color: #ffe1a0 !important;
  font-family: var(--okey-font-display) !important;
  font-size: clamp(0.58rem, 1.25cqh, 0.76rem);
  letter-spacing: 0.015em;
  text-transform: uppercase;
  text-shadow: 0 2px 2px rgba(31, 13, 5, 0.92);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .rail-icon-checkin .rail-label {
  bottom: 6.5%;
  height: 13%;
  color: #fff1bd !important;
  font-family: var(--okey-font-ui) !important;
  font-size: clamp(0.56rem, 1.18cqh, 0.72rem);
  text-shadow: 0 2px 2px rgba(21, 9, 4, 0.9);
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-bottomnav {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-content: center;
  gap: clamp(4px, 1cqw, 12px);
  padding: 7px max(6px, var(--okey-safe-right)) max(7px, var(--okey-safe-bottom)) max(6px, var(--okey-safe-left));
  border: 0 !important;
  border-top: 2px solid #b98736 !important;
  background:
    linear-gradient(180deg, rgba(36, 83, 68, 0.98), rgba(5, 38, 36, 0.99)) !important;
  box-shadow:
    inset 0 2px 0 rgba(255, 229, 151, 0.22),
    0 -7px 22px rgba(0, 0, 0, 0.42) !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab,
#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab[data-page="journey"] {
  position: relative;
  width: min(100%, 320px);
  height: 100%;
  min-height: 0;
  margin: 0 !important;
  padding: 0;
  border: 0 !important;
  border-image: none !important;
  border-radius: 0;
  background-color: transparent !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  box-shadow: none !important;
  filter: none !important;
  transition: transform 120ms ease, filter 120ms ease;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab[data-page="journey"] {
  justify-self: end;
  background-image: var(--okey-home-ui-nav-play-en) !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab[data-page="store"] {
  justify-self: start;
  background-image: var(--okey-home-ui-nav-store-en) !important;
}

:lang(zh) #home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab[data-page="journey"] {
  background-image: var(--okey-home-ui-nav-play-zh) !important;
}

:lang(zh) #home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab[data-page="store"] {
  background-image: var(--okey-home-ui-nav-store-zh) !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab .nav-label {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab.active,
#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab[data-okey-state~="active"] {
  transform: none;
  filter: brightness(1.08) saturate(1.04) !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab:hover,
#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab:focus-visible {
  filter: brightness(1.12) saturate(1.06) !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab:focus-visible {
  outline: 2px solid #ffe39a;
  outline-offset: -5px;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .nav-tab:active {
  transform: translateY(2px) scale(0.985);
  filter: brightness(0.96) saturate(1.02) !important;
}

@container okey-stage (max-width: 720px) {
  #home-screen-content.lobby[data-okey-home="formation-room"] {
    --okey-home-scene-position-x: 63%;
    --okey-home-plaza-screen-y: 70.59cqh;
    --okey-home-topbar-height: clamp(72px, 9.2cqh, 80px);
    --okey-home-resource-cap: 30px;
    --okey-home-nav-cap: clamp(46px, 12cqw, 54px);
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-topbar {
    grid-template-columns: minmax(124px, 1fr) clamp(104px, 31cqw, 128px) 44px;
    gap: 4px;
    padding-inline: max(5px, var(--okey-safe-left));
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-block {
    padding: 4px 10px 4px 3px;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar {
    width: clamp(42px, 6.6cqh, 50px);
    height: clamp(42px, 6.6cqh, 50px);
    flex-basis: clamp(42px, 6.6cqh, 50px);
    margin-left: -3px;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-resources {
    height: calc(var(--okey-home-topbar-height) - 6px);
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 1px;
    align-self: center;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .res-pill {
    min-height: 0;
    border-image-width: 7px var(--okey-home-resource-cap) !important;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .res-ico {
    width: 17px;
    height: 17px;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .res-val {
    font-size: clamp(0.62rem, 1.5cqh, 0.78rem);
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .res-plus {
    font-size: 0.88rem;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-gear {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-logo {
    top: 2.5%;
    width: min(92cqw, 430px);
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] #page-journey .lobby-play {
    top: calc(var(--okey-home-plaza-screen-y) - var(--okey-home-topbar-height) - max(12px, var(--okey-safe-top)));
    bottom: auto;
    width: min(49cqw, 240px);
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] #page-journey .lobby-side-rail {
    left: 1.5%;
    bottom: 1.5%;
    width: clamp(76px, 23cqw, 104px);
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-bottomnav {
    gap: 2px;
    padding: 5px max(3px, var(--okey-safe-right)) max(5px, var(--okey-safe-bottom)) max(3px, var(--okey-safe-left));
  }
}

@container okey-stage (max-width: 720px) {
  #home-screen-content.lobby[data-okey-home="formation-room"] #page-journey .lobby-side-rail {
    top: auto;
    bottom: 1.5%;
  }
}

@container okey-stage (max-width: 340px) {
  #home-screen-content.lobby[data-okey-home="formation-room"] {
    --okey-home-resource-cap: 27px;
    --okey-home-nav-cap: 43px;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-topbar {
    grid-template-columns: minmax(118px, 1fr) 100px 40px;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-gear {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  #home-screen-content.lobby[data-okey-home="formation-room"] .lobby-avatar-face,
#home-screen-content.lobby[data-okey-home="formation-room"] .res-ico {
    display: block;
  }
}

#home-screen-content.lobby[data-okey-home="formation-room"] .page-store-inner {
  max-width: 1180px;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn span {
  display: none !important;
}

#home-screen-content.lobby[data-okey-home="formation-room"] .lobby-play-btn svg {
  display: none !important;
}

/* Bright-world settings panel v1 -------------------------------------- */
[data-okey-settings-modal] {
  --settings-art: "assets/ui-settings/bright-world-v1/";
  padding: max(10px, var(--okey-safe-top)) max(10px, var(--okey-safe-right)) max(10px, var(--okey-safe-bottom)) max(10px, var(--okey-safe-left));
  background: rgba(10, 15, 12, 0.48);
}

[data-okey-settings-modal] > .settings-panel-v1 {
  --okey-modal-card-mobile-width: min(360px, calc(100cqw - 20px));
  /* One safe-clamped panel height shared by the base rule and the narrow-stage
     override: a 620px cap, otherwise the stage minus the clamped safe insets. */
  --settings-panel-height: min(620px, calc(100cqh - max(10px, var(--okey-safe-top)) - max(10px, var(--okey-safe-bottom))));
  --okey-modal-card-mobile-max-height: var(--settings-panel-height);
  --okey-modal-card-mobile-padding: 98px 28px 30px;
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100cqw - 20px));
  height: var(--settings-panel-height);
  max-width: none;
  max-height: var(--settings-panel-height);
  margin: auto;
  padding: 98px 28px 30px;
  overflow: visible;
  border: 0;
  border-image: none;
  border-radius: 0;
  background: #603013;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.54);
  color: #4e2a13;
  image-rendering: pixelated;
}

[data-okey-settings-modal] .settings-panel-frame {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

[data-okey-settings-modal] .settings-title-v1 {
  position: absolute;
  z-index: 2;
  top: 24px;
  left: 50%;
  width: min(276px, calc(100% - 56px));
  height: 62px;
  transform: translateX(-50%);
}

[data-okey-settings-modal] .settings-title-v1 > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

[data-okey-settings-modal] .settings-title-v1 > h2 {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  height: 100%;
  margin: 0;
  place-items: center;
  color: #593114 !important;
  font-size: clamp(18px, 5.2cqw, 23px);
  line-height: 1;
  text-shadow: 0 1px #fff1c0, 1px 2px rgba(84, 46, 17, 0.18) !important;
}

[data-okey-settings-modal] .settings-rows-v1 {
  position: relative;
  z-index: 2;
  display: grid;
  flex: 1;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
}

/* While a row's dropdown is open, let it paint below its trigger: the rows
   viewport must not clip the absolutely positioned menu, and the open row must
   stack above the sibling rows and the footer (both z-index 2). */
[data-okey-settings-modal] .settings-rows-v1:has(.custom-select-container.open) {
  overflow: visible;
  z-index: 3;
}

[data-okey-settings-modal] .settings-row-v1 {
  position: relative;
  display: grid;
  /* The generated row artwork reserves roughly 28% of its width for the
     icon well. Match that real divider instead of centering icons in the
     narrower legacy column. */
  grid-template-columns: 82px minmax(0, 1fr);
  min-height: 64px;
  margin: 0;
  padding: 0;
  align-items: center;
  border: 0 !important;
  box-shadow: none !important;
}

/* Lift the open row above its siblings so the menu that overflows its bounds
   is not painted behind the rows below or the footer. */
[data-okey-settings-modal] .settings-row-v1:has(.custom-select-container.open) {
  z-index: 3;
}

/* Keep the generic settings row contract explicit for shared UI tests. */
[data-okey-settings-modal] .setting-item,
[data-okey-settings-modal] .settings-row-v1 {
  border-radius: 0 !important;
  background: none !important;
}

[data-okey-settings-modal] .settings-row-v1::after { content: none !important; }

[data-okey-settings-modal] .settings-row-frame {
  position: absolute;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

[data-okey-settings-modal] .settings-row-icon {
  width: 50px;
  height: 50px;
  justify-self: center;
  transform: translateX(1px);
  object-fit: contain;
  pointer-events: none;
}

[data-okey-settings-modal] .settings-row-v1 > .custom-select-container,
[data-okey-settings-modal] .settings-row-v1 > .settings-volume-control,
[data-okey-settings-modal] .settings-row-v1 > .settings-onboarding-actions {
  grid-column: 2;
  justify-self: stretch;
  margin: 0 12px 0 6px;
}

[data-okey-settings-modal] .settings-labeled-row {
  grid-template-rows: auto minmax(48px, auto);
  row-gap: 0;
  min-height: 86px;
  padding-block: 12px 6px;
}

[data-okey-settings-modal] .settings-labeled-row > .settings-row-icon {
  grid-column: 1;
  grid-row: 1 / 3;
}

[data-okey-settings-modal] .settings-row-label {
  grid-column: 2;
  grid-row: 1;
  margin: 0 14px 0 12px;
  color: var(--pixel-ink, #24150f);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

[data-okey-settings-modal] .settings-labeled-row > .custom-select-container,
[data-okey-settings-modal] .settings-labeled-row > .settings-volume-control {
  grid-row: 2;
}

[data-okey-settings-modal] .settings-onboarding-action {
  position: relative;
  z-index: 2;
  min-height: 48px;
  min-width: 0;
  padding: 10px 18px 12px;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, #ffc442 0 16%, #e9a01d 17% 74%, #c66d0d 75% 100%) center / calc(100% - 26px) calc(100% - 20px) no-repeat,
    url(assets/ui-settings/bright-world-v1/settings-dropdown-field.png) center / 100% 100% no-repeat;
  color: #4a250e;
  box-shadow: none;
  font: inherit;
  font-weight: 900;
  text-shadow: 0 1px 0 #ffe079;
}

[data-okey-settings-modal] .settings-onboarding-action:is(:hover, :focus-visible) {
  filter: brightness(1.08);
}

[data-okey-settings-modal] .settings-onboarding-action:active {
  transform: translateY(2px);
}

[data-okey-settings-modal] .settings-onboarding-actions {
  position: relative;
  z-index: 2;
  display: grid;
  min-width: 0;
  margin: 0 12px 0 6px;
}

[data-okey-settings-modal] .settings-onboarding-action.is-restart {
  width: 100%;
}

@container okey-stage (max-width: 390px) {
  [data-okey-settings-modal] .settings-onboarding-action {
    padding-inline: 8px;
    font-size: .78rem;
  }
}

[data-okey-settings-modal] .settings-volume-control {
  --settings-volume-fill: 100%;
  position: relative;
  display: grid;
  align-items: center;
  height: 48px;
  margin: 0 18px 0 0;
}

[data-okey-settings-modal] .settings-volume-control::before {
  content: "";
  position: absolute;
  inset: 15px 19px;
  border: 3px solid #1c1009;
  background:
    linear-gradient(180deg, #55c6ff 0 18%, #188fdf 19% 62%, #0d67ac 63% 100%) left center / var(--settings-volume-fill) 100% no-repeat,
    linear-gradient(180deg, #80502c 0 20%, #522d18 21% 66%, #30170c 67% 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.28), inset 0 -2px 0 rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

[data-okey-settings-modal] .settings-volume-input {
  --settings-volume-fill: 100%;
  position: relative;
  z-index: 1;
  width: 100%;
  height: 48px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

[data-okey-settings-modal] .settings-volume-input::-webkit-slider-runnable-track {
  height: 14px;
  background: transparent;
}

[data-okey-settings-modal] .settings-volume-input::-webkit-slider-thumb {
  width: 38px;
  height: 40px;
  margin-top: -13px;
  appearance: none;
  border: 0;
  background: url(assets/ui-settings/bright-world-v1/settings-slider-thumb.png) center / contain no-repeat;
}

[data-okey-settings-modal] .settings-volume-input::-moz-range-track { height: 14px; background: transparent; }
[data-okey-settings-modal] .settings-volume-input::-moz-range-thumb {
  width: 38px;
  height: 40px;
  border: 0;
  background: url(assets/ui-settings/bright-world-v1/settings-slider-thumb.png) center / contain no-repeat;
}

[data-okey-settings-modal] .custom-select-container { min-width: 0; }

[data-okey-settings-modal] .settings-art-select {
  position: relative;
  width: 100%;
  min-height: 48px;
  padding: 7px 46px 7px 14px;
  border: 0;
  border-radius: 0;
  background: url(assets/ui-settings/bright-world-v1/settings-dropdown-field.png) center / 100% 100% no-repeat;
  box-shadow: none;
  color: #47240f;
  font-weight: 900;
  text-shadow: 0 1px 0 #ffe7a8 !important;
  clip-path: none;
}

[data-okey-settings-modal] .custom-select-trigger,
[data-okey-settings-modal] .settings-art-select {
  background-size: auto !important;
}

[data-okey-settings-modal] .settings-art-select .trigger-text,
html[data-visual-theme="pixel"] [data-okey-settings-modal] .settings-art-select .trigger-text {
  color: #47240f !important;
  font-weight: 900;
  text-shadow: 0 1px 0 #ffe7a8 !important;
}

[data-okey-settings-modal] .settings-art-select .trigger-arrow {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 40px;
  background: url(assets/ui-settings/bright-world-v1/settings-dropdown-chevron.png) center / contain no-repeat;
}

[data-okey-settings-modal] .custom-options-list {
  position: absolute;
  display: none;
  z-index: 20;
  top: calc(100% + 4px);
  bottom: auto;
  right: 0;
  left: 0;
  padding: 4px;
  border: 3px solid #754113;
  border-radius: 3px;
  background: #f5d78f;
  box-shadow: 0 8px 0 rgba(62, 28, 7, 0.45), inset 0 0 0 2px #d99b2e;
  background-size: auto;
}

[data-okey-settings-modal] .custom-options-list.visible {
  display: flex;
}

[data-okey-settings-modal] .custom-options-list button,
[data-okey-settings-modal] .custom-options-list button > * {
  min-height: 48px;
  border: 0;
  border-bottom: 2px solid rgba(112, 62, 17, 0.22);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #3f200d;
  font-weight: 900;
  text-shadow: 0 1px 0 #ffe6a6;
}

[data-okey-settings-modal] .custom-options-list button:last-child { border-bottom: 0; }
[data-okey-settings-modal] .custom-options-list button:is(:hover, :focus-visible, .active-option) {
  background: #f1b739;
}

[data-okey-settings-modal] .settings-footer-actions-v1 {
  position: relative;
  z-index: 2;
  display: grid;
  flex-shrink: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: calc(100% - 28px);
  margin: 14px 14px 0;
}

[data-okey-settings-modal] .settings-more-v1,
[data-okey-settings-modal] .settings-return-v1,
[data-okey-settings-modal] .settings-exit-battle-v1 {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 58px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  font: inherit;
  font-weight: 900;
}

[data-okey-settings-modal] .settings-exit-battle-v1[hidden] {
  display: none;
}

[data-okey-settings-modal] .settings-more-v1 {
  border: 3px solid var(--pixel-ink-deep, #110b08);
  border-radius: 1px;
  background: linear-gradient(180deg, #b66a2b 0 18%, #8e3f24 19% 72%, #58301d 73% 100%);
  box-shadow: inset 0 0 0 2px var(--pixel-gold, #d69b35), 4px 4px 0 var(--pixel-ink-deep, #110b08);
  color: #fff0b7;
  font-size: 19px;
  text-shadow: 0 3px 0 #4a2416;
}

[data-okey-settings-modal] .settings-return-v1 {
  background: none;
  box-shadow: none;
  color: #fff0b7;
  font-size: 22px;
  text-shadow: 0 3px 0 #183c6d;
}

[data-okey-settings-modal] .settings-exit-battle-v1 {
  --okey-danger-button-image: linear-gradient(180deg, #d65a4c 0 18%, var(--pixel-red, #b13b32) 19% 72%, var(--pixel-red-dark, #68251f) 73% 100%);
  --okey-pixel-control-background: var(--okey-danger-button-image);
  grid-column: 1 / -1;
  border: 3px solid var(--pixel-ink-deep, #110b08);
  border-radius: 1px;
  background: var(--okey-danger-button-image);
  box-shadow: inset 0 0 0 2px var(--pixel-gold, #d69b35), 4px 4px 0 var(--pixel-ink-deep, #110b08);
  color: #fff0b7;
  font-size: 18px;
  line-height: 1.05;
  text-shadow: 0 3px 0 var(--pixel-red-dark, #68251f);
}

[data-okey-settings-modal] .settings-footer-actions-v1.has-battle-exit {
  gap: 6px 8px;
  margin-top: 4px;
}

[data-okey-settings-modal] .settings-footer-actions-v1.has-battle-exit > button {
  height: 48px;
}

[data-okey-settings-modal] .settings-return-frame {
  position: absolute;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

[data-okey-settings-modal] .settings-return-label {
  position: relative;
  z-index: 1;
}

[data-okey-settings-modal] .settings-return-label {
  grid-column: 1;
}

[data-okey-settings-modal] .settings-more-v1:is(:hover, :focus-visible),
[data-okey-settings-modal] .settings-return-v1:is(:hover, :focus-visible),
[data-okey-settings-modal] .settings-exit-battle-v1:is(:hover, :focus-visible) {
  filter: brightness(1.1);
}

[data-okey-settings-modal] .settings-more-v1:active,
[data-okey-settings-modal] .settings-return-v1:active,
[data-okey-settings-modal] .settings-exit-battle-v1:active {
  transform: translateY(3px);
}

[data-okey-settings-modal] .settings-more-v1:active {
  box-shadow: inset 0 0 0 2px var(--pixel-gold, #d69b35), 1px 1px 0 var(--pixel-ink-deep, #110b08);
}

[data-okey-settings-modal] .settings-exit-battle-v1:active {
  box-shadow: inset 0 0 0 2px var(--pixel-gold, #d69b35), 1px 1px 0 var(--pixel-ink-deep, #110b08);
}

[data-okey-settings-modal] .settings-version {
  position: absolute;
  z-index: 2;
  right: 32px;
  bottom: 15px;
  left: 32px;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: none;
  color: #b98a55;
  font-size: 9px;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-okey-settings-modal] .settings-footer-actions-v1.has-battle-exit + .settings-version {
  bottom: 9px;
}

/* More settings ------------------------------------------------------ */
.settings-more-overlay {
  padding: max(16px, var(--okey-safe-top)) max(14px, var(--okey-safe-right)) max(16px, var(--okey-safe-bottom)) max(14px, var(--okey-safe-left));
}

.settings-more-card {
  width: min(340px, calc(100cqw - 28px));
  max-width: 340px;
  max-height: min(460px, calc(100cqh - 32px));
  gap: 18px;
  padding: 24px 22px 22px;
  overflow-y: auto;
}

.settings-more-card > h2 {
  margin: 0;
  padding: 0 56px 12px 0;
  border-bottom: 3px solid rgba(214, 155, 53, 0.72);
  font-size: clamp(20px, 6cqw, 26px);
}

.settings-save-management {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 3px solid var(--pixel-ink-deep, #110b08);
  background: var(--pixel-parchment, #d9b96f);
  box-shadow: inset 0 0 0 3px #f1d79c, 4px 4px 0 rgba(17, 11, 8, 0.82);
  color: var(--pixel-ink, #24150f);
}

.settings-save-management-title {
  margin: 0;
  color: var(--pixel-ink, #24150f);
  font-size: clamp(17px, 5cqw, 21px);
  font-weight: 900;
  text-shadow: 0 1px 0 #fff0b7;
}

.settings-save-management > p {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.settings-clear-save {
  --okey-danger-button-image: linear-gradient(180deg, #d65a4c 0 18%, var(--pixel-red, #b13b32) 19% 72%, var(--pixel-red-dark, #68251f) 73% 100%);
  --okey-pixel-control-background: var(--okey-danger-button-image);
  min-height: 56px;
  padding: 10px 14px;
  border: 3px solid var(--pixel-ink-deep, #110b08);
  border-radius: 1px;
  background: var(--okey-danger-button-image);
  box-shadow: inset 0 0 0 2px var(--pixel-gold, #d69b35), 4px 4px 0 var(--pixel-ink-deep, #110b08);
  color: #fff0b7;
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  text-shadow: 0 3px 0 var(--pixel-red-dark, #68251f);
}

.reset-btn[data-okey-variant="danger"] {
  --okey-danger-button-image: linear-gradient(180deg, #d65a4c 0 18%, var(--pixel-red, #b13b32) 19% 72%, var(--pixel-red-dark, #68251f) 73% 100%);
  --okey-pixel-control-background: var(--okey-danger-button-image);
}

.settings-clear-save:is(:hover, :focus-visible) {
  filter: brightness(1.1);
}

.settings-clear-save:active {
  transform: translate(3px, 3px);
  box-shadow: inset 0 0 0 2px var(--pixel-gold, #d69b35), 1px 1px 0 var(--pixel-ink-deep, #110b08);
}

.settings-more-close {
  --okey-modal-close-size: 48px;
  --okey-modal-close-line-height: 42px;
}

@container okey-stage (max-width: 350px) {
  [data-okey-settings-modal] .settings-more-v1,
  [data-okey-settings-modal] .settings-return-v1,
  [data-okey-settings-modal] .settings-exit-battle-v1 {
    font-size: 17px;
  }

  .settings-more-card {
    padding-inline: 16px;
  }

  .settings-save-management {
    padding: 13px;
  }
}

/* Developer access code ---------------------------------------------- */
.developer-code-modal {
  padding: max(16px, var(--okey-safe-top)) max(14px, var(--okey-safe-right)) max(16px, var(--okey-safe-bottom)) max(14px, var(--okey-safe-left));
}

.developer-code-card {
  position: relative;
  width: min(390px, calc(100cqw - 28px));
  max-width: 390px;
  max-height: min(500px, calc(100cqh - 32px));
  gap: 14px;
  padding: 32px 24px 24px;
  overflow-y: auto;
  border: 18px solid transparent;
  border-image-source: var(--okey-v1-art-panel);
  border-image-slice: 190;
  border-image-width: 18px;
  border-image-outset: 2px;
  border-image-repeat: stretch;
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 250, 207, 0.8), transparent 44%),
    linear-gradient(180deg, #f7dda0, #dca65b);
  color: #43210f;
  box-shadow: var(--okey-v1-shadow-panel);
}

.developer-code-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 42px;
}

.developer-code-heading h2 {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  color: #4c260f;
  font-size: clamp(1.12rem, 5cqw, 1.42rem);
  text-shadow: 0 1px 0 #fff0bc;
}

.developer-code-badge {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 2px solid #6d3819;
  border-radius: 4px;
  background: #824319;
  color: #fff1bd;
  font: 900 0.68rem/1 var(--okey-font-data);
  letter-spacing: 0.08em;
  box-shadow: inset 0 0 0 2px #b96a27, 0 3px 0 #45200f;
}

.developer-code-description {
  margin: 0;
  color: #633716;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.55;
}

.developer-code-form {
  display: grid;
  gap: 8px;
}

.developer-code-form label {
  color: #4b260f;
  font-size: 0.76rem;
  font-weight: 900;
}

.developer-code-form input {
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  border: 3px solid #4a2815;
  border-radius: 4px;
  background: #fff3c9;
  color: #3f200d;
  font: 900 0.9rem/1.3 var(--okey-font-data);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: inset 0 3px 0 rgba(90, 43, 13, 0.18);
}

.developer-code-form input:focus-visible {
  outline: 3px solid #fff0a5;
  outline-offset: 2px;
}

.developer-code-form input[aria-invalid="true"] {
  border-color: #9b2528;
}

.developer-code-status {
  min-height: 20px;
  margin: 0;
  color: #633716;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.4;
}

.developer-code-status[data-state="error"] { color: #8e1d24; }
.developer-code-status[data-state="success"] { color: #235b2e; }

.developer-code-submit {
  min-height: 52px;
  margin-top: 2px;
}

@container okey-stage (max-width: 420px) {
  .developer-code-card {
    padding: 30px 18px 20px;
  }
}

/* Developer options --------------------------------------------------- */
#modal-developer-options {
  padding: max(16px, var(--okey-safe-top)) max(14px, var(--okey-safe-right)) max(16px, var(--okey-safe-bottom)) max(14px, var(--okey-safe-left));
}

#modal-developer-options > .developer-options-card,
html[data-visual-theme="pixel"] #modal-developer-options > .developer-options-card {
  position: relative;
  width: min(390px, calc(100cqw - 28px));
  max-width: 390px;
  max-height: min(520px, calc(100cqh - 32px));
  gap: 14px;
  padding: 30px 24px 24px;
  overflow-y: auto;
  border: 18px solid transparent !important;
  border-image-source: var(--okey-v1-art-panel) !important;
  border-image-slice: 190 fill !important;
  border-image-width: 18px !important;
  border-image-outset: 2px !important;
  border-image-repeat: stretch !important;
  border-radius: 12px !important;
  background:
    radial-gradient(circle at 50% 0%, rgba(244, 221, 160, 0.1), transparent 38%),
    linear-gradient(180deg, #123d30, #071b15) !important;
  box-shadow: var(--okey-v1-shadow-panel) !important;
}

#modal-developer-options .developer-options-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 42px;
}

#modal-developer-options .developer-options-heading h2 {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: clamp(1.12rem, 5cqw, 1.42rem);
}

#modal-developer-options .developer-options-badge {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 2px solid #d9b667;
  border-radius: 4px;
  background: #442518;
  color: #ffe8a1;
  font: 900 0.72rem/1 var(--okey-font-data);
  letter-spacing: 0.08em;
  box-shadow: inset 0 0 0 2px #1f100b, 0 3px 0 #1c0d08;
}

#modal-developer-options .developer-options-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(224, 190, 103, 0.54);
  border-radius: 6px;
  background: rgba(7, 27, 21, 0.72);
  color: #e8d9ad;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.55;
}

#modal-developer-options .developer-options-actions {
  display: grid;
  gap: 12px;
}

#modal-developer-options .developer-options-actions > button {
  min-height: 62px;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 9px 14px;
  border: 0 !important;
  border-radius: 10px !important;
  background-color: #0d3a2a !important;
  background-image: var(--okey-v1-art-button-primary) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  color: #fff !important;
  box-shadow: var(--okey-v1-shadow-control) !important;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.9) !important;
}

#modal-developer-options .developer-options-actions > button:active {
  transform: translateY(3px) !important;
  box-shadow: 0 2px 0 rgba(21, 12, 8, 0.82) !important;
}

#modal-developer-options .developer-options-actions > button > span {
  font-size: 1rem;
  font-weight: 900;
}

#modal-developer-options .developer-options-actions > button > small {
  color: #fff1c6;
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.9;
}

#modal-developer-options .developer-clear-record-btn {
  background-color: #5b1620 !important;
  background-image: var(--okey-v1-art-button-danger) !important;
}

#modal-developer-options .developer-instant-clear-btn {
  background-color: #0d2540 !important;
  background-image: var(--okey-v1-art-button-info) !important;
}

#modal-developer-options .developer-advanced-tools {
  border-top: 1px solid rgba(224, 190, 103, 0.42);
  padding-top: 10px;
}

#modal-developer-options .developer-advanced-tools > summary {
  color: #f4dda0;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
}

#modal-developer-options .battle-quick-clear-setting {
  margin: 10px 0 8px;
  padding: 8px 10px;
  border: 1px solid rgba(200, 164, 94, 0.42) !important;
  border-radius: 6px !important;
  background: rgba(7, 27, 21, 0.72) !important;
  color: #f3e8c8;
  font-size: 0.72rem;
  font-weight: 800;
}

#modal-developer-options .battle-quick-clear-setting .toggle-switch {
  min-width: 76px;
  min-height: 34px;
}

#modal-developer-options .developer-secondary-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

#modal-developer-options .developer-secondary-actions > button {
  min-width: 0;
  min-height: 42px;
  padding: 6px 5px;
  font-size: 0.64rem;
}

@container okey-stage (max-width: 420px) {
  #modal-developer-options > .developer-options-card,
html[data-visual-theme="pixel"] #modal-developer-options > .developer-options-card {
    padding: 28px 18px 20px;
  }
}

/* Match-only actions must never leak into the map or home settings panel,
   even when shared modal rules assign a display value to action rows. */
[data-okey-settings-modal] > .settings-panel-v1 > .modal-actions[hidden] {
  display: none !important;
}

/* Short logical portrait stages only have ~532px of safe height. Reclaim 28px
   from the panel's top/bottom padding and compact the title/spacing so the rows
   and footer fit without the old whole-panel transform. Panel height stays the
   shared safe-clamped value. */
@container okey-stage (max-height: 600px) {
  [data-okey-settings-modal] > .settings-panel-v1 {
    --okey-modal-card-mobile-padding: 76px 28px 24px;
    padding: 76px 28px 24px;
  }

  [data-okey-settings-modal] .settings-title-v1 {
    top: 16px;
    height: 48px;
  }

  /* Keep labeled rows compact too so their 86px artwork minimum still fits the
     short stage; the docked controls stay 48px and labels 14px. */
  [data-okey-settings-modal] .settings-labeled-row {
    min-height: 80px;
  }

  /* Battle adds a third footer action row, leaving these four rows 16px taller
     than the viewport; tightening only the battle gap keeps every row and its
     48px control visible without scrolling. Map geometry is untouched. */
  [data-okey-settings-modal] > .settings-panel-v1:has(.settings-footer-actions-v1.has-battle-exit) .settings-rows-v1 {
    gap: 2px;
  }
}

html[data-visual-theme="pixel"] .okey-game-modal-overlay.modal-overlay[data-okey-settings-modal] {
  background: rgba(10, 15, 12, 0.48) !important;
}

html[data-visual-theme="pixel"] .okey-game-modal-overlay.modal-overlay[data-okey-settings-modal] > .okey-game-modal-card.modal-card.settings-panel-v1[role="dialog"] {
  border: 0 !important;
  border-radius: 0 !important;
  background: #603013 !important;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.54) !important;
}

html[data-visual-theme="pixel"] [data-okey-settings-modal] .settings-art-select,
html[data-visual-theme="pixel"] [data-okey-settings-modal] .custom-options-list {
  border-radius: 0 !important;
}

html[data-visual-theme="pixel"] [data-okey-settings-modal] .custom-options-list {
  border: 3px solid #754113 !important;
  background: #f5d78f !important;
  box-shadow: 0 8px 0 rgba(62, 28, 7, 0.45), inset 0 0 0 2px #d99b2e !important;
  background-size: auto !important;
}

html[data-visual-theme="pixel"] [data-okey-settings-modal] .settings-art-select {
  border: 0 !important;
  background: url(assets/ui-settings/bright-world-v1/settings-dropdown-field.png) center / 100% 100% no-repeat !important;
  box-shadow: none !important;
  color: #47240f !important;
}

html[data-visual-theme="pixel"] [data-okey-settings-modal] .settings-volume-input {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

@container okey-stage (max-width: 520px) {
  [data-okey-settings-modal] > .settings-panel-v1,
html[data-visual-theme="pixel"] [data-okey-settings-modal] > .settings-panel-v1 {
    width: min(360px, calc(100cqw - 20px));
    height: var(--settings-panel-height);
    max-height: var(--settings-panel-height);
    /* Consume the variable so this later narrow-stage rule cannot undo the
       compact short-stage padding above. */
    padding: var(--okey-modal-card-mobile-padding);
  }
}

/* Battle Codex collection album ---------------------------------------- */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

#battle-codex-panel.battle-codex-panel {
  --codex-gold: #d6b768;
  --codex-gold-hi: #f7e8ad;
  --codex-ink: #071611;
  overflow-x: hidden;
  padding: 8px max(9px, var(--okey-safe-right)) 18px max(9px, var(--okey-safe-left));
  background-color: #071b15 !important;
  background-image:
    linear-gradient(180deg, rgba(9, 39, 29, 0.9), rgba(3, 15, 11, 0.96)),
    var(--okey-v1-art-ground) !important;
  background-position: center !important;
  background-size: cover !important;
}

#battle-codex-panel .battle-codex-header,
#battle-codex-panel .battle-codex-tabs,
#battle-codex-panel .battle-codex-controls,
#battle-codex-panel .battle-codex-filters,
#battle-codex-panel .battle-codex-note,
#battle-codex-panel .battle-codex-grid {
  width: min(100%, 1180px);
  margin-inline: auto;
}

#battle-codex-panel .battle-codex-header {
  min-height: 40px;
  margin-bottom: 6px;
  padding: 5px 8px;
  display: grid;
  grid-template-columns: auto minmax(54px, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(214, 183, 104, 0.68) !important;
  border-radius: 4px;
  background-color: #102e24 !important;
  background-image: linear-gradient(180deg, rgba(38, 81, 62, 0.94), rgba(8, 31, 23, 0.98)) !important;
  box-shadow: inset 0 0 0 1px rgba(4, 14, 11, 0.72), inset 0 1px rgba(255, 246, 205, 0.08), 0 3px 8px rgba(0, 0, 0, 0.28);
}

#battle-codex-panel .battle-codex-header > div {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

#battle-codex-panel .battle-codex-kicker {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: #c7aa68 !important;
  font-size: 0.5rem;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

#battle-codex-panel .battle-codex-header h2 {
  margin: 0;
  color: #f7e8ad !important;
  font-size: 0.9rem;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

#battle-codex-panel .battle-codex-progress {
  height: 5px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(214, 183, 104, 0.56);
  border-radius: 2px;
  background: #06130f;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.72);
}

#battle-codex-panel .battle-codex-progress > i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #8e6e2d, #e7ca77, #fff0b2);
  transition: width 180ms ease;
}

#battle-codex-panel .battle-codex-count {
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid rgba(232, 204, 128, 0.72);
  border-radius: 3px;
  background: #0a2219;
  color: #fff0b5;
  font-family: var(--okey-font-data) !important;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.64);
}

#battle-codex-panel .battle-codex-tabs {
  margin-bottom: 6px;
  padding: 2px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  border: 1px solid rgba(214, 183, 104, 0.4);
  border-radius: 4px;
  background: rgba(3, 17, 12, 0.82);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.52);
}

#battle-codex-panel .battle-codex-tab {
  min-width: 0;
  min-height: 34px;
  padding: 3px 2px;
  border: 1px solid rgba(148, 125, 72, 0.66) !important;
  border-radius: 2px;
  background-color: #132a23 !important;
  background-image: linear-gradient(180deg, #25483b, #0d241c) !important;
  color: #d9ccb0;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 1px 2px #000;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05);
  clip-path: none;
}

#battle-codex-panel .battle-codex-tab.active {
  border-color: #e8cd82 !important;
  background-color: #3c2b15 !important;
  background-image: linear-gradient(180deg, #75602d, #30230f) !important;
  color: #fff1b8 !important;
  box-shadow: inset 0 0 0 1px rgba(255, 238, 174, 0.16), 0 0 7px rgba(219, 179, 75, 0.2);
}

#battle-codex-panel .battle-codex-controls {
  margin-bottom: 5px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px;
}

#battle-codex-panel .battle-codex-search {
  position: relative;
  min-width: 0;
}

#battle-codex-panel .battle-codex-search::before {
  content: "⌕";
  position: absolute;
  left: 9px;
  top: 50%;
  z-index: 1;
  transform: translateY(-52%);
  color: #d6b768;
  font-family: var(--okey-font-data);
  font-size: 1rem;
  line-height: 1;
  pointer-events: none;
}

#battle-codex-panel .battle-codex-search input,
#battle-codex-panel .battle-codex-filter-grid select {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid rgba(214, 183, 104, 0.62);
  border-radius: 3px;
  background: #071c15;
  color: #f4e7c3;
  font-family: var(--okey-font-data) !important;
  font-size: 0.72rem;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.58), inset 0 1px 3px rgba(0, 0, 0, 0.46);
}

#battle-codex-panel .battle-codex-search input {
  padding: 0 9px 0 29px;
}

#battle-codex-panel .battle-codex-search input::placeholder {
  color: #9f9b86;
  opacity: 1;
}

#battle-codex-panel .battle-codex-filter-toggle,
#battle-codex-panel .battle-codex-filter-reset,
#battle-codex-panel .battle-codex-empty button {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(214, 183, 104, 0.72);
  border-radius: 3px;
  background: linear-gradient(180deg, #365546, #142d24);
  color: #f5e5b9;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08), 0 2px 4px rgba(0, 0, 0, 0.28);
}

#battle-codex-panel .battle-codex-filter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

#battle-codex-panel .battle-codex-filter-toggle b {
  min-width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #8a2637;
  color: #fff2d5;
  font-family: var(--okey-font-data) !important;
  font-size: 0.56rem;
}

#battle-codex-panel .battle-codex-filter-toggle b[hidden] {
  display: none !important;
}

#battle-codex-panel .battle-codex-filters {
  margin-bottom: 5px;
  padding: 7px;
  border: 1px solid rgba(214, 183, 104, 0.48);
  border-radius: 3px;
  background: rgba(5, 25, 18, 0.96);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5);
}

#battle-codex-panel .battle-codex-filters[hidden] {
  display: none !important;
}

#battle-codex-panel .battle-codex-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

#battle-codex-panel .battle-codex-filter-grid label {
  min-width: 0;
  display: grid;
  gap: 3px;
}

#battle-codex-panel .battle-codex-filter-grid label > span {
  color: #baa973;
  font-size: 0.54rem;
  font-weight: 700;
  line-height: 1;
}

#battle-codex-panel .battle-codex-filter-grid select {
  height: 32px;
  padding: 0 6px;
  font-size: 0.64rem;
}

#battle-codex-panel .battle-codex-filter-reset {
  width: 100%;
  min-height: 30px;
  margin-top: 7px;
}

#battle-codex-panel .battle-codex-note {
  min-height: 20px;
  margin-bottom: 5px;
  padding: 2px 5px;
  border: 0 !important;
  border-bottom: 1px solid rgba(214, 183, 104, 0.28) !important;
  border-radius: 0;
  background: transparent !important;
  color: #bfbca8;
  font-family: var(--okey-font-data) !important;
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1.25;
  box-shadow: none;
}

#battle-codex-panel .battle-codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  align-items: start;
  gap: 8px;
}

:root {
  --battle-unit-frame-tier-0: url(assets/battle-ui/unit-card-frame-tier-0-v1.webp?v=1);
  --battle-unit-frame-tier-1: url(assets/battle-ui/unit-card-frame-tier-1-v1.webp?v=1);
  --battle-unit-frame-tier-2: url(assets/battle-ui/unit-card-frame-tier-2-v1.webp?v=1);
  --battle-unit-frame-tier-3: url(assets/battle-ui/unit-card-frame-tier-3-v1.webp?v=1);
  --battle-unit-frame-tier-4: url(assets/battle-ui/unit-card-frame-tier-4-v1.webp?v=1);
  --battle-unit-frame-tier-5: url(assets/battle-ui/unit-card-frame-tier-5-v1.webp?v=1);
  --battle-unit-frame-tier-6: url(assets/battle-ui/unit-card-frame-tier-6-v1.webp?v=1);
}

.bb-catalog-card.tier-frame-0{
  --battle-unit-frame: var(--battle-unit-frame-tier-0);
}

.bb-catalog-card.tier-frame-1{
  --battle-unit-frame: var(--battle-unit-frame-tier-1);
}

.bb-catalog-card.tier-frame-2{
  --battle-unit-frame: var(--battle-unit-frame-tier-2);
}

.bb-catalog-card.tier-frame-3{
  --battle-unit-frame: var(--battle-unit-frame-tier-3);
}

.bb-catalog-card.tier-frame-4{
  --battle-unit-frame: var(--battle-unit-frame-tier-4);
}

.bb-catalog-card.tier-frame-5{
  --battle-unit-frame: var(--battle-unit-frame-tier-5);
}

.bb-catalog-card.tier-frame-6{
  --battle-unit-frame: var(--battle-unit-frame-tier-6);
}

.bb-catalog-card.is-locked::before {
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.48)) !important;
}

.bb-catalog-card.is-equipped::before {
  filter: brightness(1.18) saturate(1.12) drop-shadow(0 0 5px rgba(255, 205, 76, 0.72)) !important;
}

#battle-codex-panel .battle-codex-collection-card {
  --codex-card-top: #345b4a;
  --codex-card-bottom: #10271f;
  --codex-card-accent: #b99b55;
  position: relative;
  min-width: 0;
  width: 100%;
  aspect-ratio: 3 / 4;
  padding: 7px;
  border: 0 !important;
  border-radius: 5px;
  overflow: hidden;
  background-color: var(--codex-card-bottom) !important;
  background-image:
    radial-gradient(circle at 50% 25%, color-mix(in srgb, var(--codex-card-accent) 22%, transparent), transparent 42%),
    linear-gradient(180deg, var(--codex-card-top), var(--codex-card-bottom)) !important;
  color: #f6e8bd;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
  content-visibility: auto;
  contain: layout paint style;
  contain-intrinsic-size: 150px 200px;
  isolation: isolate;
  text-align: left;
  transform: translateZ(0);
}

#battle-codex-panel .battle-codex-collection-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  background: url(assets/battle-ui/barracks-card-frame-v1.webp?v=1) center / 100% 100% no-repeat;
  pointer-events: none;
}

.bb-catalog-card::before,
#battle-codex-panel .battle-codex-collection-card::before {
  background-image: var(--battle-unit-frame, url(assets/battle-ui/barracks-card-frame-v1.webp?v=1)) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
}

#battle-codex-panel .battle-codex-collection-card::after {
  content: "";
  position: absolute;
  inset: 7px;
  z-index: 0;
  border: 1px solid color-mix(in srgb, var(--codex-card-accent) 52%, #d9c489);
  border-radius: 2px;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.42);
  pointer-events: none;
}

#battle-codex-panel .battle-codex-collection-card:is(:active, :focus-visible) {
  filter: brightness(1.08);
}

#battle-codex-panel .battle-codex-card-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: 19px minmax(0, 1fr) 38px 30px 18px;
  overflow: hidden;
}

#battle-codex-panel .battle-codex-card-art {
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 0 4px;
  overflow: hidden;
  border-top: 1px solid rgba(244, 224, 161, 0.66);
  border-bottom: 1px solid rgba(4, 11, 9, 0.76);
  /* Darker well so pixel sprites do not melt into parchment. */
  background:
    radial-gradient(circle at 50% 78%, rgba(0, 0, 0, 0.22), transparent 55%),
    linear-gradient(180deg, #3a4a42 0%, #1a2822 55%, #0c1612 100%);
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.28);
}

#battle-codex-panel .battle-codex-card-art .bb-unit-portrait-shell {
  inset: 4px 6px 2px;
  place-items: end center;
  overflow: hidden;
}

#battle-codex-panel .battle-codex-card-art .bb-unit-portrait {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 2px 0 rgba(8, 5, 3, 0.9));
}

#battle-codex-panel .battle-codex-card-art .bb-unit-sprite {
  width: min(112px, 88%);
  max-width: none;
  animation: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#battle-codex-panel .battle-codex-card-copy {
  min-width: 0;
  padding: 3px 5px 1px;
  display: grid;
  align-content: center;
  gap: 1px;
  text-align: center;
}

#battle-codex-panel .battle-codex-card-copy b {
  min-width: 0;
  max-height: 2.15em;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #fff0b7;
  font-size: 0.67rem;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0;
  text-shadow: 0 1px 2px #000;
}

#battle-codex-panel .battle-codex-card-copy small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #c7c2a8;
  font-size: 0.49rem;
  line-height: 1.1;
}

#battle-codex-panel .battle-codex-card-stats {
  min-width: 0;
  margin: 0 4px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  border-top: 1px solid rgba(221, 195, 123, 0.28);
  border-bottom: 1px solid rgba(0, 0, 0, 0.42);
}

#battle-codex-panel .battle-codex-card-stats > span {
  min-width: 0;
  display: grid;
  place-items: center;
  align-content: center;
  border-right: 1px solid rgba(221, 195, 123, 0.18);
}

#battle-codex-panel .battle-codex-card-stats > span:last-child {
  border-right: 0;
}

#battle-codex-panel .battle-codex-card-stats small,
#battle-codex-panel .battle-codex-card-stats b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--okey-font-data) !important;
  line-height: 1;
}

#battle-codex-panel .battle-codex-card-stats small {
  color: #aaa690;
  font-size: 0.43rem;
}

#battle-codex-panel .battle-codex-card-stats b {
  margin-top: 2px;
  color: #fff1bb;
  font-size: 0.58rem;
}

#battle-codex-panel .battle-codex-collection-card.is-equipped {
  box-shadow: 0 0 0 2px #f0d27d, 0 0 15px rgba(232, 196, 101, 0.42), 0 5px 8px rgba(0, 0, 0, 0.44);
}

#battle-codex-panel .battle-codex-empty {
  grid-column: 1 / -1;
  min-height: 168px;
  padding: 24px 16px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed rgba(214, 183, 104, 0.52);
  border-radius: 4px;
  color: #d7cba9;
  text-align: center;
}

#battle-codex-panel .battle-codex-empty b {
  color: #f0dca2;
  font-size: 0.78rem;
}

#battle-codex-panel .battle-codex-empty span {
  font-size: 0.65rem;
}

#modal-battle-codex-detail {
  padding: 10px;
}

#modal-battle-codex-detail > .battle-codex-detail-card {
  position: relative;
  width: min(calc(100cqw - 20px), 760px);
  max-width: 760px;
  max-height: 86cqh;
  padding: 16px 13px 14px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(229, 200, 121, 0.84);
  border-radius: 5px;
  background-color: #0a241b !important;
  background-image:
    linear-gradient(180deg, rgba(30, 69, 52, 0.96), rgba(7, 25, 19, 0.99)),
    var(--okey-v1-art-ground) !important;
  background-position: center !important;
  background-size: cover !important;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.72), 0 16px 36px rgba(0, 0, 0, 0.58);
}
#modal-battle-codex-detail > .battle-codex-detail-card.is-class-detail {
  width: min(calc(100cqw - 20px), 860px);
  max-width: 860px;
}

#modal-battle-codex-detail .battle-codex-detail-card > .battle-codex-detail-close {
  position: absolute !important;
  top: 7px !important;
  right: 7px !important;
  left: auto !important;
  inset-inline-start: auto !important;
  inset-inline-end: 7px !important;
  z-index: 12;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 3px;
  font-size: 1.05rem;
  line-height: 1;
}

#modal-battle-codex-detail .battle-codex-detail-body {
  min-width: 0;
  padding-top: 17px;
}

#modal-battle-codex-detail .battle-codex-detail-layout {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(100px, 144px) minmax(0, 1fr);
  gap: 12px;
}

#modal-battle-codex-detail .battle-codex-detail-hero {
  position: relative;
  min-width: 0;
  min-height: 150px;
  align-self: start;
  overflow: hidden;
  border: 1px solid rgba(228, 200, 125, 0.66);
  border-radius: 4px;
  background: radial-gradient(circle at 50% 38%, rgba(224, 226, 181, 0.6), rgba(21, 64, 49, 0.88) 62%, #091c16);
  box-shadow: inset 0 -18px 28px rgba(0, 0, 0, 0.3);
}

#modal-battle-codex-detail .battle-codex-detail-art {
  position: absolute;
  inset: 5px;
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: inherit;
}

#modal-battle-codex-detail .battle-codex-detail-art .bb-unit-portrait-shell {
  inset: 8px;
  place-items: end center;
  overflow: hidden;
}

#modal-battle-codex-detail .battle-codex-detail-art .bb-unit-portrait {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 2px 0 rgba(8, 5, 3, 0.9));
}

#modal-battle-codex-detail .battle-codex-detail-main {
  min-width: 0;
}

#modal-battle-codex-detail .battle-codex-detail-title {
  padding-right: 30px;
}

#modal-battle-codex-detail .battle-codex-detail-title h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  line-height: 1.15;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

#modal-battle-codex-detail .battle-codex-detail-title p,
#modal-battle-codex-detail .battle-codex-detail-note,
#modal-battle-codex-detail .battle-codex-detail-locked p {
  font-size: 0.68rem;
  line-height: 1.45;
}

#modal-battle-codex-detail .battle-codex-detail-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

#modal-battle-codex-detail .battle-codex-detail-stats > span {
  min-width: 0;
  padding: 6px 7px;
  border-radius: 3px;
  overflow-wrap: anywhere;
}

#modal-battle-codex-detail .battle-codex-detail-actions {
  margin-top: 10px;
}

@container okey-stage (max-width: 430px) {
  #battle-codex-panel .battle-codex-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #battle-codex-panel .battle-codex-collection-card {
    contain-intrinsic-size: 142px 190px;
  }
}

@container okey-stage (max-width: 359px) {
  #battle-codex-panel .battle-codex-header {
    grid-template-columns: auto minmax(32px, 1fr) auto;
    gap: 5px;
  }

  #battle-codex-panel .battle-codex-kicker {
    display: none;
  }

  #battle-codex-panel .battle-codex-tabs {
    gap: 2px;
  }

  #battle-codex-panel .battle-codex-tab {
    font-size: 0.62rem;
  }
}

@container okey-stage (max-width: 520px) {
  #battle-codex-panel .battle-codex-collection-card {
    transform: none;
  }

  #modal-battle-codex-detail {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  #modal-battle-codex-detail .battle-codex-detail-layout {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 9px;
  }

  #modal-battle-codex-detail .battle-codex-detail-layout.is-class{
    grid-template-columns: 1fr;
  }

  #modal-battle-codex-detail .battle-codex-detail-hero {
    min-height: 122px;
  }

  #modal-battle-codex-detail .battle-codex-detail-layout.is-class .battle-codex-detail-hero{
    width: 118px;
    min-height: 104px;
    margin-inline: auto;
  }

  #modal-battle-codex-detail .battle-codex-detail-title h3 {
    font-size: 0.88rem;
  }

  #modal-battle-codex-detail .battle-codex-detail-stats {
    grid-template-columns: 1fr;
  }
}

/* Battle Codex collectible-card redesign ------------------------------- */
:root {
  --codex-art-nameplate: url(assets/battle-ui/codex-card-nameplate-v1.webp?v=1);
  --codex-art-stat-medallion: url(assets/battle-ui/codex-stat-medallion-v1.webp?v=1);
  --codex-art-tab-frame: url(assets/battle-ui/codex-tab-frame-v1.webp?v=1);
  --codex-art-control-frame: url(assets/battle-ui/codex-control-frame-v1.webp?v=1);
}

.battle-map-content[data-hub-tab="codex"] .battle-age-switch-btn {
  display: none !important;
}

.battle-map-content[data-hub-tab="codex"] .battle-map-settings-btn {
  margin-left: auto !important;
}

.battle-map-content[data-hub-tab="codex"] .battle-map-wallet {
  flex: 0 1 auto;
  width: max-content;
  max-width: min(46cqw, 240px);
  justify-content: flex-start !important;
  overflow: hidden;
}

.battle-map-content[data-hub-tab="codex"] .battle-map-wallet .bm-coins {
  flex: 0 1 auto;
  width: max-content;
  max-width: 100%;
}

.battle-map-content[data-hub-tab="codex"] .battle-map-wallet .bm-coins b {
  flex: 0 1 auto;
  max-width: min(34cqw, 190px);
}

#battle-codex-panel.battle-codex-panel {
  padding: 6px max(9px, var(--okey-safe-right)) 22px max(9px, var(--okey-safe-left));
  background-color: #061812 !important;
  background-image:
    radial-gradient(circle at 50% 10%, rgba(41, 83, 62, 0.42), transparent 34%),
    linear-gradient(180deg, rgba(7, 29, 22, 0.88), rgba(2, 12, 9, 0.97)),
    var(--okey-v1-art-ground) !important;
}

#battle-codex-panel .battle-codex-header {
  min-height: 86px;
  margin-bottom: 4px;
  padding: 2px 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none;
}

#battle-codex-panel .battle-codex-header::before {
  content: none;
}

#battle-codex-panel .battle-codex-header > .battle-codex-heading {
  position: relative;
  width: min(100%, 520px);
  min-width: 0;
}

#battle-codex-panel .battle-codex-title-art {
  width: 100%;
  height: auto;
  max-height: 112px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.72));
}

#battle-codex-panel .battle-codex-accessible-title {
  position: absolute !important;
}

#battle-codex-panel .battle-codex-kicker {
  color: #d1af64 !important;
  font-family: var(--okey-font-display) !important;
  font-size: clamp(0.42rem, 1.55cqw, 0.62rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#battle-codex-panel .battle-codex-header h2 {
  color: #f6e5ad !important;
  font-family: var(--okey-font-display) !important;
  font-size: clamp(1.48rem, 6.6cqw, 2.8rem);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  text-shadow: 0 2px 3px #000, 0 0 12px rgba(217, 174, 74, 0.14);
}

#battle-codex-panel .battle-codex-progress {
  height: 3px;
  min-width: 34px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: linear-gradient(90deg, rgba(214, 183, 104, 0.16), rgba(214, 183, 104, 0.68), rgba(214, 183, 104, 0.16));
  box-shadow: 0 1px rgba(0, 0, 0, 0.72);
}

#battle-codex-panel .battle-codex-progress > i {
  height: 3px;
  background: linear-gradient(90deg, #8e6e2d, #e7ca77, #fff0b2);
  box-shadow: 0 0 7px rgba(231, 202, 119, 0.3);
}

#battle-codex-panel .battle-codex-tabs {
  margin-bottom: 4px;
  padding: 0;
  gap: 4px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

#battle-codex-panel .battle-codex-tab,
#battle-codex-panel .battle-codex-tab.active {
  min-height: 34px;
  padding: 5px 7px;
  border: 0 !important;
  border-radius: 0;
  background-color: transparent !important;
  background-image: var(--codex-art-tab-frame) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  color: #e8ddbf !important;
  font-family: var(--okey-font-display) !important;
  font-size: clamp(0.64rem, 2.65cqw, 0.88rem);
  font-weight: 700;
  text-transform: uppercase;
  text-shadow: 0 2px 2px #000;
  box-shadow: none;
}

#battle-codex-panel .battle-codex-tab.active {
  color: #fff0b8 !important;
  filter: brightness(1.28) saturate(1.18);
  box-shadow: 0 0 8px rgba(221, 174, 63, 0.32);
}

#battle-codex-panel .battle-codex-controls {
  margin-bottom: 4px;
  gap: 5px;
}

#battle-codex-panel .battle-codex-search input,
#battle-codex-panel .battle-codex-filter-toggle,
#battle-codex-panel .battle-codex-filter-reset,
#battle-codex-panel .battle-codex-empty button {
  min-height: 35px;
  height: 35px;
  border: 0 !important;
  border-radius: 0;
  background-color: transparent !important;
  background-image: var(--codex-art-control-frame) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  box-shadow: none;
}

#battle-codex-panel .battle-codex-search input {
  padding: 0 13px 0 35px;
  color: #f4e7c3;
  font-size: 0.76rem;
}

#battle-codex-panel .battle-codex-search::before {
  left: 13px;
  color: #dcbf73;
}

#battle-codex-panel .battle-codex-filter-toggle {
  min-width: 70px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #f5e5b9;
  font-size: 0.68rem;
}

#battle-codex-panel .battle-codex-filter-icon {
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  color: #d8b969;
  filter: drop-shadow(0 1px 1px #000);
}

#battle-codex-panel .battle-codex-filters {
  margin-bottom: 7px;
  padding: 9px;
  border: 0;
  border-radius: 0;
  background-color: rgba(4, 20, 15, 0.97);
  background-image: var(--codex-art-control-frame);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

#battle-codex-panel .battle-codex-summary {
  width: min(100%, 1180px);
  margin: 0 auto 6px;
  display: grid;
  grid-template-columns: 0.92fr 0.92fr 1.32fr;
  gap: 5px;
}

#battle-codex-panel .battle-codex-summary > span,
#battle-codex-panel .battle-codex-summary > strong {
  min-width: 0;
  min-height: 31px;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--codex-art-control-frame) center / 100% 100% no-repeat !important;
  color: #f2dfaa;
  font-family: var(--okey-font-data) !important;
  font-size: clamp(0.54rem, 2.2cqw, 0.74rem);
  font-weight: 800;
  line-height: 1.08;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px #000;
}

#battle-codex-panel .battle-codex-summary > :is(span, strong) > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#battle-codex-panel .battle-codex-summary-icon {
  flex: 0 0 clamp(12px, 3.4cqw, 18px);
  width: clamp(12px, 3.4cqw, 18px);
  height: clamp(12px, 3.4cqw, 18px);
  color: #d2ad5d;
  filter: drop-shadow(0 1px 1px #000);
}

#battle-codex-panel .battle-codex-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(6px, 1.9cqw, 12px);
  row-gap: clamp(5px, 1.6cqw, 10px);
}

#battle-codex-panel .battle-codex-collection-card {
  width: 100%;
  aspect-ratio: 2 / 3;
  padding: 7px;
  overflow: hidden;
  border-radius: 4px;
  background-color: transparent !important;
  background-image: none !important;
  content-visibility: auto;
  contain: layout paint style;
  contain-intrinsic-size: 154px 231px;
}

#battle-codex-panel .battle-codex-collection-card::after {
  inset: 10px;
  border: 0;
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.48);
}

#battle-codex-panel .battle-codex-card-inner{
  grid-template-rows: minmax(0, 1fr) 54px auto;
  overflow: visible;
}

#battle-codex-panel .battle-codex-card-art {
  margin: 0 4px;
  overflow: hidden;
  /* Soften crest clip so weapons/heads are not shaved off. */
  -webkit-clip-path: polygon(50% 4%, 68% 8%, 82% 14%, 93% 22%, 93% 100%, 7% 100%, 7% 22%, 18% 14%, 32% 8%);
  clip-path: polygon(50% 4%, 68% 8%, 82% 14%, 93% 22%, 93% 100%, 7% 100%, 7% 22%, 18% 14%, 32% 8%);
  border: 1px solid rgba(230, 207, 141, 0.4);
  border-radius: 2px 2px 8px 8px;
  background:
    radial-gradient(ellipse 70% 36% at 50% 88%, rgba(0, 0, 0, 0.35), transparent 70%),
    linear-gradient(180deg, #2f433c 0%, #172620 58%, #0a1411 100%);
}

#battle-codex-panel .battle-codex-card-art .bb-unit-portrait-shell {
  /* Stay inside card; no negative inset that clips heads/weapons. */
  inset: 6px 8px 4px;
  place-items: end center;
  overflow: hidden;
}

#battle-codex-panel .battle-codex-card-art .bb-unit-portrait {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 2px 0 rgba(8, 5, 3, 0.92));
}

#battle-codex-panel .battle-codex-card-copy {
  position: relative;
  z-index: 7;
  width: calc(100% - 26px);
  min-height: 54px;
  margin: -7px auto 0;
  padding: 7px 12px 6px;
  justify-self: center;
  background: var(--codex-art-nameplate) center / 100% 100% no-repeat;
}

#battle-codex-panel .battle-codex-card-copy b {
  max-height: 2.5em;
  color: #fff0bd;
  font-family: var(--okey-font-display) !important;
  font-size: clamp(0.76rem, 3.6cqw, 1.12rem);
  line-height: 1.08;
  text-transform: uppercase;
  text-shadow: 0 2px 2px #000;
}

#battle-codex-panel .battle-codex-collection-card.has-two-word-title .battle-codex-card-copy b {
  justify-self: center;
}

#battle-codex-panel .battle-codex-collection-card.has-compact-title .battle-codex-card-copy b {
  font-size: clamp(0.46rem, 2.2cqw, 0.76rem);
  letter-spacing: -0.025em;
}

#battle-codex-panel .battle-codex-collection-card.has-long-word-title .battle-codex-card-copy b {
  font-size: clamp(0.55rem, 2.35cqw, 0.8rem);
  letter-spacing: -0.025em;
}

#battle-codex-panel .battle-codex-card-meta {
  min-width: 0;
  min-height: 42px;
  margin: 0 7px 7px;
  padding: 8px 12px;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  background: var(--codex-art-control-frame) center / 100% 100% no-repeat;
  color: #d4c9aa;
  font-family: var(--okey-font-data) !important;
  font-size: clamp(0.42rem, 1.7cqw, 0.62rem);
  line-height: 1.25;
  text-align: center;
}

#battle-codex-panel .battle-codex-card-stats {
  min-width: 0;
  min-height: 55px;
  margin: 0 13px 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  border: 0;
}

#battle-codex-panel .battle-codex-card-stats > span {
  flex: 1 1 33.333%;
  min-width: 0;
  max-width: 72px;
  aspect-ratio: 1;
  border: 0;
  background: var(--codex-art-stat-medallion) center / contain no-repeat;
}

#battle-codex-panel .battle-codex-card-stats small {
  color: #c8b88b;
  font-size: clamp(0.43rem, 1.7cqw, 0.58rem);
  font-weight: 800;
}

#battle-codex-panel .battle-codex-card-stats b {
  margin-top: 2px;
  color: #fff0b7;
  font-size: clamp(0.82rem, 3.3cqw, 1.08rem);
}
#battle-codex-panel .battle-codex-card-copy small {
  display: none !important;
}

@container okey-stage (min-width: 640px) {
  #battle-codex-panel .battle-codex-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@container okey-stage (min-width: 1000px) {
  #battle-codex-panel .battle-codex-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@container okey-stage (max-width: 359px) {
  #battle-codex-panel .battle-codex-header {
    min-height: 80px;
  }

  #battle-codex-panel .battle-codex-tab {
    min-height: 32px;
    padding-inline: 4px;
    font-size: 0.52rem;
  }

  #battle-codex-panel .battle-codex-summary {
    gap: 3px;
  }

  #battle-codex-panel .battle-codex-summary > span,
#battle-codex-panel .battle-codex-summary > strong {
    min-height: 29px;
    padding-inline: 5px;
    font-size: 0.46rem;
  }

  #battle-codex-panel .battle-codex-card-copy {
    width: calc(100% - 22px);
    margin-inline: auto;
    padding-inline: 10px;
  }

  #battle-codex-panel .battle-codex-card-stats {
    margin-inline: 11px;
  }
}

/* Issue #391: unowned equipment stays visible but visually de-emphasized. */
#battle-codex-panel .battle-codex-collection-card.is-unowned .battle-codex-card-art {
  filter: grayscale(0.55) brightness(0.82);
  opacity: 0.78;
}

#battle-codex-panel .battle-codex-collection-card.is-unowned .battle-codex-card-copy {
  opacity: 0.88;
}

@container okey-stage (max-width: 430px) {
  #battle-codex-panel .battle-codex-tabs {
    gap: 2px;
    overflow-x: auto;
  }

  #battle-codex-panel .battle-codex-tab,
#battle-codex-panel .battle-codex-tab.active {
    min-height: 32px;
    padding: 4px 2px;
    font-size: clamp(0.6rem, 2.9cqw, 0.88rem);
    line-height: 1.05;
  }

  /* Issue #391 review: on narrow phones the nameplate/meta/stats rows squeezed
     the equipment art well to ~14px. Give equipment cards enough height and a
     compact single-medallion stats row so the item icon is fully visible. */
  #battle-codex-panel .battle-codex-collection-card.is-equipment {
    min-height: 280px;
    contain-intrinsic-size: 148px 280px;
  }

  #battle-codex-panel .battle-codex-collection-card.is-equipment .battle-codex-card-stats {
    min-height: 52px;
    margin-bottom: 9px;
  }

  #battle-codex-panel .battle-codex-collection-card.is-equipment .battle-codex-card-stats > span {
    max-width: 52px;
  }

  #battle-codex-panel .battle-codex-collection-card.is-equipment .battle-codex-equipment-icon .sa-formal-item-icon {
    width: min(60%, 72px);
    max-height: calc(100% - 6px);
  }
}
