@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@600;700;800;900&family=Noto+Sans+TC:wght@400;500;600;700;800;900&display=swap');

:root {
  --v2-night: #020711;
  --v2-navy-950: #04101f;
  --v2-navy-900: #071a32;
  --v2-navy-800: #0b2b50;
  --v2-navy-700: #124273;
  --v2-blue: #2169a6;
  --v2-gold-100: #fff2bf;
  --v2-gold-200: #f5d88d;
  --v2-gold-400: #d6a23b;
  --v2-gold-500: #bd7c18;
  --v2-gold-700: #75430a;
  --v2-paper-50: #fff8e5;
  --v2-paper-100: #f5e6bf;
  --v2-paper-200: #dfc382;
  --v2-ink: #2d1a08;
  --v2-red-950: #1d0304;
  --v2-red-800: #4f0d0c;
  --v2-red-600: #a32918;
  --v2-header: 92px;
  --v2-sidebar: 198px;
  --v2-shadow: 0 16px 38px rgba(0, 0, 0, .48);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.kingdom-v2-page {
  min-width: 320px;
  margin: 0;
  color: var(--v2-gold-100);
  background:
    linear-gradient(rgba(2, 7, 17, .45), rgba(2, 7, 17, .78)),
    url('../assets/kingdom-v2/backgrounds/player-home-city.webp') center top / cover fixed no-repeat,
    var(--v2-night);
  font-family: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
}
body.kingdom-v2-page [hidden] { display: none !important; }
body.kingdom-v2-page button,
body.kingdom-v2-page input { font: inherit; }
body.kingdom-v2-page a { color: inherit; }

.v2-skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 1000;
  padding: 10px 16px;
  color: #201100;
  background: var(--v2-gold-200);
}
.v2-skip-link:focus { top: 12px; }

/* Top navigation */
.v2-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--v2-header);
  display: grid;
  grid-template-columns: 330px minmax(600px, 1fr) 270px;
  align-items: stretch;
  padding: 0 22px;
  border-bottom: 1px solid var(--v2-gold-500);
  color: var(--v2-gold-100);
  background:
    linear-gradient(180deg, rgba(5, 20, 40, .99), rgba(2, 9, 20, .99)),
    var(--v2-navy-950);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .55), inset 0 -3px rgba(214, 162, 59, .1);
}
.v2-topbar::after {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 4px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--v2-gold-400) 12%, var(--v2-gold-200) 50%, var(--v2-gold-400) 88%, transparent);
}
.v2-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--v2-gold-200);
  text-decoration: none;
}
.v2-brand img {
  width: 75px;
  height: 78px;
  object-fit: contain;
  filter: drop-shadow(0 7px 12px rgba(0,0,0,.55));
}
.v2-brand span { min-width: 0; }
.v2-brand strong {
  display: block;
  font: 900 22px/1.25 'Noto Serif TC', serif;
  letter-spacing: .04em;
  white-space: nowrap;
}
.v2-brand small {
  display: block;
  margin-top: 4px;
  color: #bfae82;
  font-size: 12px;
  white-space: nowrap;
}
.v2-topnav {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(72px, 1fr));
  align-items: stretch;
}
.v2-topnav a {
  position: relative;
  min-width: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 1px;
  border-left: 1px solid rgba(214, 162, 59, .18);
  color: #d7c99f;
  text-align: center;
  text-decoration: none;
  transition: .18s ease;
}
.v2-topnav a:last-child { border-right: 1px solid rgba(214, 162, 59, .18); }
.v2-topnav a span { color: var(--v2-gold-200); font: 900 23px/1 Georgia, serif; }
.v2-topnav a b { font-size: 13px; white-space: nowrap; }
.v2-topnav a small { color: #8fa2b7; font: 700 9px/1.1 Georgia, serif; letter-spacing: .08em; }
.v2-topnav a:hover,
.v2-topnav a.is-active {
  color: var(--v2-gold-100);
  background: linear-gradient(180deg, rgba(25, 73, 119, .76), rgba(5, 23, 47, .38));
}
.v2-topnav a.is-active::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 3px;
  background: var(--v2-gold-400);
  box-shadow: 0 0 12px rgba(245,216,141,.62);
}
.v2-session {
  min-width: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-left: 16px;
}
.v2-session-avatar {
  width: 48px;
  height: 48px;
  border: 2px solid var(--v2-gold-400);
  border-radius: 50%;
  background:
    url('../assets/kingdom-v2/characters/avatar-swordsman-male.webp') center 12% / cover no-repeat,
    var(--v2-navy-800);
}
.v2-session strong,
.v2-session small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-session strong { font-family: 'Noto Serif TC', serif; }
.v2-session small { margin-top: 3px; color: #aebed0; font-size: 11px; }
.v2-logout {
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--v2-gold-500);
  border-radius: 4px;
  color: var(--v2-gold-100);
  background: linear-gradient(180deg, var(--v2-navy-700), var(--v2-navy-950));
  font-weight: 800;
  cursor: pointer;
}

/* App shell and side rail */
.v2-app-shell {
  display: grid;
  grid-template-columns: var(--v2-sidebar) minmax(0, 1fr);
  min-height: calc(100vh - var(--v2-header));
}
.v2-sidebar {
  position: sticky;
  top: var(--v2-header);
  align-self: start;
  height: calc(100vh - var(--v2-header));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--v2-gold-500);
  color: var(--v2-gold-100);
  background:
    radial-gradient(circle at 50% 5%, rgba(47, 120, 188, .22), transparent 240px),
    linear-gradient(180deg, rgba(7, 28, 54, .99), rgba(2, 9, 20, .995));
  box-shadow: 8px 0 24px rgba(0, 0, 0, .34), inset -4px 0 rgba(214, 162, 59, .06);
}
.v2-side-title {
  padding: 22px 16px 14px;
  border-bottom: 1px solid rgba(214,162,59,.24);
  color: var(--v2-gold-200);
  text-align: center;
  font: 900 18px/1.3 'Noto Serif TC', serif;
}
.v2-side-title span,
.v2-side-title small { display: block; }
.v2-side-title small { margin-top: 3px; color: #a7956f; font: 700 10px Georgia, serif; letter-spacing: .1em; }
.v2-side-nav {
  display: grid;
  gap: 2px;
  padding: 10px 8px;
  overflow: auto;
}
.v2-side-nav a,
.v2-side-nav button {
  width: 100%;
  min-height: 53px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 3px;
  color: #d8caa6;
  background: transparent;
  text-align: left;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}
.v2-side-nav img {
  grid-row: 1 / 3;
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.35));
}
.v2-side-nav small { color: #8297ad; font: 700 9px Georgia, serif; letter-spacing: .07em; }
.v2-side-nav a:hover,
.v2-side-nav button:hover,
.v2-side-nav .is-active {
  border-color: rgba(214,162,59,.58);
  color: var(--v2-gold-100);
  background: linear-gradient(90deg, rgba(29, 92, 151, .8), rgba(6, 29, 58, .78));
  box-shadow: inset 3px 0 var(--v2-gold-400);
}
.v2-side-motto {
  margin-top: auto;
  min-height: 210px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 18px 12px;
  border-top: 1px solid rgba(214,162,59,.25);
  background:
    linear-gradient(rgba(2, 10, 22, .32), rgba(2, 10, 22, .74)),
    url('../assets/kingdom-v2/backgrounds/player-home-city.webp') center bottom / cover no-repeat;
  text-align: center;
}
.v2-side-motto strong { font: 700 13px/1.8 'Noto Serif TC', serif; }
.v2-compass {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 3px double var(--v2-gold-400);
  border-radius: 50%;
  color: var(--v2-gold-200);
  background: rgba(3, 14, 31, .72);
  font: 900 42px/1 Georgia, serif;
  transform: rotate(20deg);
}

.v2-main {
  min-width: 0;
  padding: 12px 14px 26px;
}
.v2-notice {
  margin-bottom: 10px;
  padding: 10px 14px;
  border: 1px solid var(--v2-gold-400);
  color: #5a3306;
  background: var(--v2-paper-50);
}

/* Auth gates */
.v2-gate {
  max-width: 1100px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 30px;
  margin: 70px auto;
  padding: 36px;
  border: 1px solid var(--v2-gold-400);
  background: linear-gradient(145deg, rgba(10, 42, 80, .98), rgba(2, 11, 25, .99));
  box-shadow: var(--v2-shadow);
}
.v2-gate h1,
.v2-gate h2 { margin: 0 0 12px; font: 900 38px/1.2 'Noto Serif TC', serif; }
.v2-gate p { color: #c1d0df; }
.v2-gate-center { display: flex; flex-direction: column; align-items: center; text-align: center; }
.v2-gate-center img { width: 100px; }
.v2-provider-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.v2-login-form { display: grid; gap: 14px; }
.v2-login-form label { display: grid; gap: 6px; color: var(--v2-gold-200); font-weight: 700; }
.v2-login-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--v2-gold-500);
  border-radius: 3px;
  color: var(--v2-ink);
  background: var(--v2-paper-50);
}
.v2-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border-radius: 3px;
  text-decoration: none;
  font-weight: 900;
  cursor: pointer;
}
.v2-btn-gold {
  border: 1px solid var(--v2-gold-700);
  color: #281501;
  background: linear-gradient(180deg, #ffe9a8, var(--v2-gold-400) 58%, var(--v2-gold-500));
  box-shadow: inset 0 1px rgba(255,255,255,.65), 0 3px 0 #704005;
}
.v2-btn-blue {
  border: 1px solid var(--v2-gold-500);
  color: var(--v2-gold-100);
  background: linear-gradient(180deg, var(--v2-navy-700), var(--v2-navy-950));
}

/* Dashboard hero */
.v2-dashboard { max-width: 1450px; margin: 0 auto; }
.v2-hero {
  position: relative;
  height: 218px;
  display: grid;
  grid-template-columns: 440px minmax(0, 1fr);
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid var(--v2-gold-500);
  background:
    linear-gradient(90deg, rgba(3, 13, 29, .18), rgba(3, 13, 29, .1)),
    url('../assets/kingdom-v2/backgrounds/player-home-city.webp') center 42% / cover no-repeat;
  box-shadow: 0 0 0 4px rgba(2, 9, 19, .93), 0 0 0 5px rgba(214,162,59,.48), var(--v2-shadow);
}
.v2-hero::after {
  content: '';
  position: absolute;
  inset: 6px;
  z-index: 8;
  pointer-events: none;
  border: 22px solid transparent;
  border-image: url('../assets/kingdom-v2/ui/main-ornate-frame.webp') 112 / 20px stretch;
}
.v2-hero-scroll {
  position: relative;
  z-index: 5;
  align-self: center;
  width: 420px;
  margin-left: 20px;
  padding: 19px 36px 18px;
  color: var(--v2-ink);
  text-align: center;
  background:
    linear-gradient(rgba(255,248,225,.97), rgba(229,202,140,.96)),
    repeating-linear-gradient(0deg, rgba(92,57,14,.04) 0 1px, transparent 1px 4px);
  clip-path: polygon(5% 0, 95% 0, 100% 10%, 97% 91%, 92% 100%, 8% 100%, 2% 91%, 0 10%);
  box-shadow: 0 15px 30px rgba(0,0,0,.3);
}
.v2-hero-scroll::before,
.v2-hero-scroll::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  background: linear-gradient(90deg, #7d4a0a, #e2ba61, #7d4a0a);
}
.v2-hero-scroll::before { left: 0; }
.v2-hero-scroll::after { right: 0; }
.v2-hero-scroll span { color: #6c3c07; font: 800 17px/1.2 'Noto Serif TC', serif; letter-spacing: .15em; }
.v2-hero-scroll h1 { margin: 2px 0 7px; color: #382006; font: 900 43px/1.15 'Noto Serif TC', serif; }
.v2-hero-scroll p { margin: 0; font: 700 13px/1.55 'Noto Serif TC', serif; }
.v2-hero-scroll strong {
  display: block;
  margin: 10px -10px -8px;
  padding: 7px 14px;
  color: var(--v2-gold-200);
  background: linear-gradient(180deg, var(--v2-navy-800), var(--v2-navy-950));
  font: 800 14px/1.3 'Noto Serif TC', serif;
}
.v2-party {
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.v2-party::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(5,18,37,.38), transparent 28%, transparent 76%, rgba(5,18,37,.25));
}
.v2-party img {
  position: absolute;
  bottom: -74px;
  width: 245px;
  height: 300px;
  object-fit: cover;
  object-position: center top;
  border-radius: 48% 48% 0 0;
  filter: drop-shadow(0 14px 14px rgba(0,0,0,.48));
}
.v2-party-one { left: 4%; z-index: 4; }
.v2-party-two { left: 25%; z-index: 3; transform: scale(.9); }
.v2-party-three { left: 47%; z-index: 4; transform: scale(.95); }
.v2-party-four { left: 68%; z-index: 3; transform: scale(.9); }

/* Main dashboard grid */
.v2-dashboard-grid {
  display: grid;
  grid-template-columns: 1.08fr .92fr 1.28fr;
  grid-template-areas:
    'profile pass missions'
    'stats stats missions'
    'boss boss rewards';
  grid-template-rows: 292px 88px 245px;
  gap: 10px;
}
.v2-panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--v2-gold-500);
  box-shadow: 0 0 0 3px rgba(2,9,19,.92), 0 0 0 4px rgba(214,162,59,.38), var(--v2-shadow);
}
.v2-profile-card { grid-area: profile; }
.v2-pass-card { grid-area: pass; }
.v2-mission-board { grid-area: missions; }
.v2-stat-row { grid-area: stats; }
.v2-boss-card { grid-area: boss; }
.v2-reward-cards { grid-area: rewards; }

/* Profile card */
.v2-profile-card {
  padding: 17px 18px 14px;
  color: var(--v2-ink);
  background:
    radial-gradient(circle at 85% 27%, rgba(166,119,38,.13), transparent 34%),
    repeating-linear-gradient(0deg, rgba(91,58,18,.035) 0 1px, transparent 1px 4px),
    linear-gradient(135deg, var(--v2-paper-50), var(--v2-paper-100) 72%, var(--v2-paper-200));
}
.v2-profile-card::after,
.v2-mission-board::after {
  content: '';
  position: absolute;
  inset: 7px;
  pointer-events: none;
  border: 1px solid rgba(111,67,12,.38);
}
.v2-profile-top {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}
.v2-profile-art {
  position: relative;
  width: 142px;
  height: 153px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: transparent;
  border-radius: 48% 48% 42% 42%;
  background:
    var(--v2-avatar, url('../assets/kingdom-v2/characters/avatar-swordsman-male.webp')) center 8% / cover no-repeat,
    var(--v2-navy-800);
  filter: drop-shadow(0 9px 9px rgba(67,36,5,.3));
}
.v2-profile-art::after {
  content: '';
  position: absolute;
  inset: -7px;
  background: url('../assets/kingdom-v2/ui/avatar-frame.webp') center / contain no-repeat;
  pointer-events: none;
}
.v2-class-tag {
  display: inline-flex;
  margin-bottom: 7px;
  padding: 5px 18px;
  color: var(--v2-gold-100);
  background: linear-gradient(180deg, var(--v2-navy-700), var(--v2-navy-950));
  clip-path: polygon(7% 0, 93% 0, 100% 50%, 93% 100%, 7% 100%, 0 50%);
  font: 800 12px/1.3 'Noto Serif TC', serif;
}
.v2-profile-top h2 { margin: 0; color: #301b06; font: 900 34px/1.2 'Noto Serif TC', serif; }
.v2-profile-top strong { color: #6b3c07; font: 800 14px/1.4 Georgia, serif; }
.v2-profile-meta { position: relative; z-index: 2; display: grid; gap: 3px; margin: 8px 0 5px; }
.v2-profile-meta div { display: flex; justify-content: space-between; gap: 14px; }
.v2-profile-meta dt { color: #72582c; font-size: 11px; }
.v2-profile-meta dd { margin: 0; font-size: 11px; font-weight: 800; }
.v2-profile-level { position: relative; z-index: 2; display: flex; justify-content: space-between; padding-top: 5px; border-top: 1px solid rgba(93,57,12,.35); font-size: 12px; }
.v2-profile-level b { color: #0b3c71; font: 900 20px/1 'Noto Serif TC', serif; }
.v2-exp-track {
  position: relative;
  z-index: 2;
  height: 10px;
  overflow: hidden;
  margin-top: 6px;
  border: 1px solid #7b4b0d;
  border-radius: 999px;
  background: #031326;
}
.v2-exp-track > div { width: 0; height: 100%; background: linear-gradient(90deg, #1c75bd, #75d9ff, #fff0a5); transition: width .5s ease; }
.v2-exp-caption { position: relative; z-index: 2; display: flex; justify-content: space-between; margin-top: 4px; color: #604a28; font-size: 9px; }

/* Pass card */
.v2-pass-card {
  padding: 15px 16px 12px;
  color: var(--v2-gold-100);
  text-align: center;
  background:
    radial-gradient(circle at 50% -12%, rgba(41,119,191,.45), transparent 55%),
    linear-gradient(145deg, var(--v2-navy-800), var(--v2-navy-950));
}
.v2-pass-card::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 12px solid transparent;
  border-image: url('../assets/kingdom-v2/ui/hero-content-frame.webp') 106 / 11px stretch;
  pointer-events: none;
}
.v2-pass-card > * { position: relative; z-index: 2; }
.v2-pass-card header h2 { margin: 0; font: 900 25px/1.2 'Noto Serif TC', serif; }
.v2-pass-card header span { display: block; margin: 4px auto 8px; max-width: 320px; color: #bdcce0; font-size: 10px; line-height: 1.45; }
.v2-eyebrow { margin: 0 0 3px; color: var(--v2-gold-400); font: 900 10px/1.2 Georgia, serif; letter-spacing: .15em; text-transform: uppercase; }
.v2-qr {
  width: 137px;
  height: 137px;
  display: grid;
  place-items: center;
  margin: 0 auto 8px;
  padding: 8px;
  border: 5px double var(--v2-gold-400);
  background: #fff;
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
}
.v2-qr canvas,
.v2-qr img,
.v2-qr svg { width: 114px !important; height: 114px !important; }
.v2-pass-meta { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid rgba(214,162,59,.5); }
.v2-pass-meta span { padding: 6px; color: #a9bdd2; font-size: 9px; }
.v2-pass-meta span + span { border-left: 1px solid rgba(214,162,59,.5); }
.v2-pass-meta strong { display: block; margin-top: 2px; color: var(--v2-gold-100); font-size: 12px; }

/* Mission board */
.v2-mission-board {
  padding: 12px 18px 13px;
  color: var(--v2-ink);
  background:
    repeating-linear-gradient(0deg, rgba(91,58,18,.035) 0 1px, transparent 1px 4px),
    linear-gradient(135deg, var(--v2-paper-50), #ead29a 72%, #c99f50);
}
.v2-mission-board header { position: relative; z-index: 2; padding: 1px 0 8px; border-bottom: 2px solid rgba(102,61,8,.42); text-align: center; }
.v2-mission-board header h2 { margin: 0; font: 900 30px/1.2 'Noto Serif TC', serif; }
.v2-mission-board header span { color: #77551f; font: 700 10px Georgia, serif; letter-spacing: .12em; }
.v2-mission-list { position: relative; z-index: 2; display: grid; gap: 6px; padding: 8px 0; }
.v2-mission-list .kingdom-mission-item,
.v2-mission-list .kingdom-empty-mini {
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid rgba(104,64,10,.34);
  color: var(--v2-ink);
  background: rgba(255,248,224,.58);
}
.v2-mission-list .kingdom-mission-item-head { display: flex; justify-content: space-between; gap: 8px; }
.v2-mission-list h3 { margin: 1px 0 2px; font: 800 13px/1.25 'Noto Serif TC', serif; }
.v2-mission-list p { margin: 0; color: #6a5432; font-size: 9px; line-height: 1.35; }
.v2-mission-list .kingdom-mission-code { color: #9b630f; font-size: 8px; font-weight: 900; }
.v2-mission-list .kingdom-mission-reward { flex: 0 0 auto; color: #824807; font-size: 10px; font-weight: 900; }
.v2-board-button,
.v2-boss-button {
  position: relative;
  z-index: 2;
  min-height: 31px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  border: 1px solid var(--v2-gold-500);
  color: var(--v2-gold-100);
  background: linear-gradient(180deg, var(--v2-navy-700), var(--v2-navy-950));
  text-decoration: none;
  font: 800 12px/1 'Noto Serif TC', serif;
}
.v2-board-button span,
.v2-boss-button span { color: var(--v2-gold-400); font-size: 22px; }

/* Stats */
.v2-stat-row {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.v2-stat-row article {
  min-width: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  align-content: center;
  column-gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--v2-gold-500);
  color: var(--v2-gold-100);
  background: linear-gradient(145deg, var(--v2-navy-800), var(--v2-navy-950));
  box-shadow: 0 0 0 3px rgba(2,9,19,.9), 0 0 0 4px rgba(214,162,59,.32);
}
.v2-stat-row img { grid-row: 1 / 4; width: 43px; height: 43px; object-fit: contain; }
.v2-stat-row span { color: #b7c6d5; font-size: 9px; }
.v2-stat-row strong { overflow: hidden; color: var(--v2-gold-100); font: 900 20px/1.2 'Noto Serif TC', serif; text-overflow: ellipsis; white-space: nowrap; }
.v2-stat-row small { color: #8ba0b4; font-size: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Boss card */
.v2-boss-card {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  color: var(--v2-gold-100);
  background:
    linear-gradient(90deg, rgba(35,4,6,.94), rgba(82,15,13,.68)),
    url('../assets/kingdom-v2/backgrounds/boss-arena-burning-city.webp') center / cover no-repeat;
}
.v2-boss-card::after {
  content: '';
  position: absolute;
  inset: 6px;
  pointer-events: none;
  border: 1px solid rgba(238,143,65,.5);
}
.v2-boss-art { position: relative; z-index: 2; overflow: hidden; }
.v2-boss-art img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 12px 12px rgba(0,0,0,.55)); }
.v2-boss-content { position: relative; z-index: 2; padding: 12px 17px 12px 4px; }
.v2-boss-content header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.v2-boss-content header h2 { margin: 0; font: 900 25px/1.2 'Noto Serif TC', serif; }
#kingdom-player-boss-state { padding: 6px 11px; border: 1px solid #d97a3d; border-radius: 999px; color: #ffc79d; background: rgba(90,19,14,.78); font-size: 11px; font-weight: 900; }
.v2-boss-hp { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px; }
.v2-boss-hp span { color: #ddb99b; font-size: 10px; }
.v2-boss-hp strong { font: 900 18px/1 'Noto Serif TC', serif; }
.v2-boss-track { height: 11px; overflow: hidden; margin: 5px 0 8px; border: 1px solid #e38c43; border-radius: 999px; background: #140304; }
.v2-boss-track > div { width: 0; height: 100%; background: linear-gradient(90deg, #b10f0c, #f04727 60%, #ffad59); box-shadow: 0 0 14px rgba(255,71,31,.7); }
.v2-boss-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.v2-boss-stats div { min-width: 0; padding: 7px 8px; border: 1px solid rgba(231,133,63,.44); background: rgba(42,5,7,.68); }
.v2-boss-stats span { display: block; color: #d0a58b; font-size: 8px; }
.v2-boss-stats strong { display: block; margin-top: 2px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.v2-boss-button { width: 130px; min-height: 30px; margin: 8px 0 0 auto; cursor: pointer; }
.v2-hidden-source { display: none; }

/* Rewards */
.v2-reward-cards {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.v2-reward-card {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  justify-items: center;
  overflow: hidden;
  padding: 10px 8px 8px;
  border: 1px solid var(--v2-gold-500);
  color: var(--v2-gold-100);
  background:
    radial-gradient(circle at 50% 30%, rgba(33,94,151,.33), transparent 47%),
    linear-gradient(145deg, var(--v2-navy-800), var(--v2-navy-950));
  box-shadow: 0 0 0 3px rgba(2,9,19,.9), 0 0 0 4px rgba(214,162,59,.32);
  text-align: center;
}
.v2-reward-card h3 { margin: 0; color: var(--v2-gold-200); font: 900 15px/1.2 'Noto Serif TC', serif; }
.v2-reward-card h3 small { display: block; margin-top: 2px; color: #8c9db0; font: 700 8px Georgia, serif; }
.v2-reward-card > img { width: 83px; height: 83px; object-fit: contain; align-self: center; filter: drop-shadow(0 8px 8px rgba(0,0,0,.45)); }
.v2-reward-card > span { color: #aebed0; font-size: 8px; }
.v2-reward-card > strong { max-width: 100%; overflow: hidden; color: var(--v2-gold-200); font: 900 15px/1.4 'Noto Serif TC', serif; text-overflow: ellipsis; white-space: nowrap; }
.v2-reward-card button {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 5px;
  padding: 5px 9px;
  border: 1px solid var(--v2-gold-500);
  color: var(--v2-gold-100);
  background: rgba(2, 10, 23, .62);
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}
.v2-reward-card button b { color: var(--v2-gold-400); font-size: 18px; }

/* Footer */
.v2-footer {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 22px 0 calc(var(--v2-sidebar) + 22px);
  border-top: 1px solid rgba(214,162,59,.48);
  color: #9dadbc;
  background: rgba(2,8,18,.98);
  font-size: 10px;
}
.v2-footer nav { display: flex; gap: 22px; }
.v2-footer a { text-decoration: none; }

/* System source and dialogs */
.v2-system-source { display: none !important; }
.v2-dialog {
  width: min(980px, calc(100% - 24px));
  max-height: min(820px, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--v2-gold-500);
  color: var(--v2-gold-100);
  background: linear-gradient(145deg, var(--v2-navy-800), var(--v2-navy-950));
  box-shadow: 0 0 0 5px rgba(2,9,19,.94), 0 0 0 6px rgba(214,162,59,.52), 0 30px 80px rgba(0,0,0,.7);
}
.v2-dialog::backdrop { background: rgba(1,5,13,.78); backdrop-filter: blur(5px); }
.v2-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--v2-gold-500);
}
.v2-dialog-head h2 { margin: 0; font: 900 27px/1.2 'Noto Serif TC', serif; }
.v2-dialog-head button { width: 38px; height: 38px; border: 1px solid var(--v2-gold-500); color: var(--v2-gold-100); background: var(--v2-navy-950); font-size: 24px; cursor: pointer; }
.v2-dialog-body { max-height: 700px; overflow: auto; padding: 18px; }
.v2-dialog-body .v2-system-source { display: grid !important; gap: 16px; }
.v2-dialog-body .kingdom-chest-actions,
.v2-dialog-body #kingdom-active-coupons,
.v2-dialog-body #kingdom-equipment-list,
.v2-dialog-body #kingdom-reward-pool,
.v2-dialog-body #kingdom-opening-history {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(214,162,59,.4);
  background: rgba(255,247,219,.94);
  color: var(--v2-ink);
}
.v2-dialog-body .kingdom-coupon-card,
.v2-dialog-body .kingdom-equipment-card,
.v2-dialog-body .kingdom-pool-row,
.v2-dialog-body .kingdom-ledger-item {
  padding: 11px;
  border: 1px solid rgba(104,63,9,.3);
  background: rgba(255,255,255,.38);
}
.v2-dialog-body .kingdom-equipment-card { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: center; }
.v2-dialog-body .kingdom-equipment-card img { width: 64px; height: 64px; object-fit: contain; }
.v2-record-grid { max-height: 700px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; overflow: auto; padding: 18px; }
.v2-record-grid section { min-width: 0; padding: 14px; border: 1px solid rgba(214,162,59,.38); color: var(--v2-ink); background: var(--v2-paper-100); }
.v2-record-grid h3 { margin: 0 0 10px; font: 900 18px/1.2 'Noto Serif TC', serif; }
.v2-record-grid .kingdom-ledger-item,
.v2-record-grid .kingdom-player-battle-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(98,59,10,.25); }
.v2-record-grid p { margin: 2px 0 0; color: #715a38; font-size: 10px; }
.v2-result-dialog { width: min(520px, calc(100% - 24px)); }
.v2-result-body { display: grid; justify-items: center; gap: 12px; padding: 30px; text-align: center; }
.v2-result-icon { width: 150px; height: 150px; display: grid; place-items: center; font-size: 70px; }
.v2-result-icon img { max-width: 100%; max-height: 100%; object-fit: contain; }
.v2-result-body h2 { margin: 0; font: 900 30px/1.2 'Noto Serif TC', serif; }
.v2-result-body p { color: #bed0e1; }

.kingdom-empty-mini { padding: 12px; color: #7a6646; text-align: center; }
.kingdom-toast-stack { position: fixed; right: 18px; top: 110px; z-index: 300; display: grid; gap: 8px; }
.kingdom-toast { min-width: 260px; padding: 12px 14px; border: 1px solid var(--v2-gold-500); color: var(--v2-gold-100); background: var(--v2-navy-900); box-shadow: var(--v2-shadow); transition: .25s ease; }
.kingdom-toast p { margin: 4px 0 0; color: #b5c5d5; font-size: 12px; }
.kingdom-mobile-nav { display: none !important; }

/* Tablet */
@media (max-width: 1260px) {
  :root { --v2-sidebar: 178px; }
  .v2-topbar { grid-template-columns: 260px minmax(510px, 1fr) 225px; padding: 0 12px; }
  .v2-brand strong { font-size: 18px; }
  .v2-brand small { display: none; }
  .v2-brand img { width: 62px; height: 68px; }
  .v2-topnav a b { font-size: 11px; }
  .v2-session { padding-left: 8px; }
  .v2-dashboard-grid { grid-template-columns: 1fr 1fr; grid-template-areas: 'profile pass' 'missions missions' 'stats stats' 'boss boss' 'rewards rewards'; grid-template-rows: 300px 250px 92px 255px 230px; }
  .v2-mission-list { grid-template-columns: repeat(2, 1fr); }
  .v2-hero { grid-template-columns: 390px 1fr; }
  .v2-hero-scroll { width: 370px; }
  .v2-party img { width: 220px; }
}

/* Mobile and narrow tablet */
@media (max-width: 900px) {
  :root { --v2-header: 68px; }
  .v2-topbar { height: var(--v2-header); grid-template-columns: minmax(0,1fr) auto; padding: 0 10px; }
  .v2-brand img { width: 50px; height: 54px; }
  .v2-brand strong { font-size: 16px; }
  .v2-topnav { display: none; }
  .v2-session { grid-template-columns: 38px minmax(0,1fr) auto; }
  .v2-session-avatar { width: 38px; height: 38px; }
  .v2-session small { display: none; }
  .v2-logout { min-height: 34px; padding: 0 10px; }
  .v2-app-shell { display: block; }
  .v2-sidebar { display: none; }
  .v2-main { padding: 8px 8px 84px; }
  .v2-dashboard { max-width: 720px; }
  .v2-hero { height: 270px; grid-template-columns: 1fr; }
  .v2-hero-scroll { width: calc(100% - 30px); max-width: 440px; margin: 14px auto 0; align-self: start; padding: 16px 28px; }
  .v2-hero-scroll h1 { font-size: 34px; }
  .v2-party { position: absolute; inset: 95px 0 0; opacity: .78; }
  .v2-party img { bottom: -110px; width: 190px; height: 240px; }
  .v2-dashboard-grid { display: grid; grid-template-columns: 1fr; grid-template-areas: 'profile' 'pass' 'missions' 'stats' 'boss' 'rewards'; grid-template-rows: auto; }
  .v2-profile-card,
  .v2-pass-card,
  .v2-mission-board { min-height: 300px; }
  .v2-stat-row { grid-template-columns: 1fr 1fr; }
  .v2-boss-card { min-height: 400px; grid-template-columns: 1fr; }
  .v2-boss-art { position: absolute; right: -20px; bottom: 0; width: 54%; height: 54%; opacity: .72; }
  .v2-boss-content { padding: 16px; }
  .v2-boss-stats { grid-template-columns: 1fr 1fr; }
  .v2-reward-cards { min-height: 260px; }
  .v2-footer { padding: 10px 12px; flex-direction: column; }
  .v2-gate { grid-template-columns: 1fr; margin: 30px auto; padding: 24px; }
  .v2-record-grid { grid-template-columns: 1fr; }
  .kingdom-mobile-nav {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 8px;
    z-index: 120;
    display: grid !important;
    grid-template-columns: repeat(5, 1fr);
    border: 1px solid var(--v2-gold-500);
    color: var(--v2-gold-100);
    background: rgba(3,14,31,.97);
    box-shadow: 0 10px 30px rgba(0,0,0,.6);
  }
  .kingdom-mobile-nav a { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; color: inherit; text-decoration: none; font-size: 10px; }
  .kingdom-mobile-nav span { color: var(--v2-gold-400); }
}

@media (max-width: 560px) {
  .v2-brand span { display: none; }
  .v2-topbar { grid-template-columns: 60px minmax(0,1fr); }
  .v2-session { padding-left: 0; }
  .v2-session strong { font-size: 12px; }
  .v2-hero { height: 245px; }
  .v2-hero-scroll { margin-top: 10px; padding: 13px 22px; }
  .v2-hero-scroll h1 { font-size: 29px; }
  .v2-hero-scroll p { font-size: 11px; }
  .v2-party img { width: 150px; height: 210px; }
  .v2-party-one { left: -4%; }
  .v2-party-two { left: 19%; }
  .v2-party-three { left: 43%; }
  .v2-party-four { left: 67%; }
  .v2-profile-top { grid-template-columns: 118px 1fr; }
  .v2-profile-art { width: 116px; height: 130px; }
  .v2-profile-top h2 { font-size: 28px; }
  .v2-stat-row { grid-template-columns: 1fr; }
  .v2-reward-cards { grid-template-columns: 1fr; }
  .v2-reward-card { min-height: 210px; }
  .v2-reward-card > img { width: 98px; height: 98px; }
  .v2-pass-meta { grid-template-columns: 1fr; }
  .v2-pass-meta span + span { border-left: 0; border-top: 1px solid rgba(214,162,59,.5); }
  .v2-mission-list { grid-template-columns: 1fr; }
  .v2-dialog-body .kingdom-equipment-card { grid-template-columns: 60px 1fr; }
  .v2-dialog-body .kingdom-equipment-card button { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
