/* Shared kingdom surfaces and navigation */
:root {
  --kingdom-ink: #1a392f;
  --kingdom-deep: #173e33;
  --kingdom-jade: #24624c;
  --kingdom-gold: #bf9255;
  --kingdom-gold-light: #e5c895;
  --kingdom-sand: #f2e8d6;
  --kingdom-paper: #fffaf0;
  --kingdom-line: #d7c8ac;
  --kingdom-shadow: 0 8px 24px #41311b12;
  --family-panel-ink: var(--kingdom-ink);
  --family-panel-line: var(--kingdom-line);
  --family-panel-muted: #4c6055;
  --family-button-line: #b4a88b;
  --family-button-bg: #f6efdf;
  --family-button-hover: #ede1c7;
  --family-button-ink: var(--kingdom-deep);
  --family-button-primary: var(--kingdom-jade);
  --family-button-primary-hover: var(--kingdom-deep);
  --kingdom-icon-citadel: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='M3 21V7h3v3h3V5l3-2 3 2v5h3V7h3v14H3Z M9 21v-4a3 3 0 0 1 6 0v4 M12 7v3'/%3E%3C/svg%3E");
  --kingdom-icon-map: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 6 6-3 6 3 6-3v15l-6 3-6-3-6 3V6Zm6-3v15m6-12v15'/%3E%3C/svg%3E");
  --kingdom-icon-members: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='7' r='3'/%3E%3Cpath d='M6 20v-2a6 6 0 0 1 12 0v2H6ZM3 17v-2a4 4 0 0 1 2.5-3.7M21 17v-2a4 4 0 0 0-2.5-3.7M5 6a2.2 2.2 0 0 0 0 4m14-4a2.2 2.2 0 0 1 0 4'/%3E%3C/svg%3E");
  --kingdom-icon-crown: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='M3 8l5 4 4-8 4 8 5-4-2 11H5L3 8Zm2 8h14m-9-2 2-3 2 3'/%3E%3C/svg%3E");
  --kingdom-icon-scroll: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 4h12a2 2 0 0 1 0 4h-2v11a2 2 0 0 1-2 2H4a2 2 0 0 1 0-4h2V6a2 2 0 0 1 4 0v2H6m4 4h4m-4 4h4'/%3E%3C/svg%3E");
  --kingdom-icon-forge: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m13 4 7 7-3 3-7-7 3-3ZM13 10 4 19l2 2 9-9M10 21h10'/%3E%3C/svg%3E");
  --kingdom-icon-letter: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='6' width='18' height='12' rx='2'/%3E%3Cpath d='m4 7 8 6 8-6'/%3E%3C/svg%3E");
  --kingdom-icon-supply: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 8 9-5 9 5v9l-9 5-9-5V8Zm0 0 9 5 9-5m-9 5v9M7.5 5.5l9 5v4'/%3E%3C/svg%3E");
  --kingdom-icon-shield: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 3 8 3v5c0 4-3 7.5-8 10-5-2.5-8-6-8-10V6l8-3Zm0 5v8m-3-5h6'/%3E%3C/svg%3E");
}

body {
  background: radial-gradient(ellipse at 50% 0, #fffdf3, transparent 70vh), #f1eade;
  color: var(--kingdom-ink);
}

.test-ribbon {
  border-block-end: 1px solid #a77e45;
  background: #ebd8af;
  color: #503d21;
}

.family-page-sticky,
.family-page-sticky:has(.family-campaign-slot:not([hidden])) {
  border-block-end-color: #a58553;
  background: linear-gradient(145deg, #234e3f, #142f27 74%);
  box-shadow: 0 4px 14px #192e2755;
}

.family-page-nav [data-family-section] {
  border-color: #f4d69a30;
  border-radius: 9px;
  color: #eeeadd;
  background: #172f2777;
}

.family-page-nav [data-family-section]:hover {
  color: #fff6df;
  background: #305d48;
}

.family-page-nav [data-family-section][aria-current="location"] {
  border-color: #c69959;
  color: #ffebbf;
  background: linear-gradient(155deg, #3d6c50, #25513e 80%);
  box-shadow: inset 0 1px #ffdc9b37, 0 2px 6px #0b211aaa;
}

.family-page-nav [data-family-section][aria-current="location"]::after {
  inset-block-end: 2px;
  background: #f3ca82;
}

.family-page-nav [data-family-section]:focus-visible { outline-color: #ffe7a9; }
.family-page-nav [data-family-section="home"] { --kingdom-icon: var(--kingdom-icon-citadel); }
.family-page-nav [data-family-section="conquest"] { --kingdom-icon: var(--kingdom-icon-map); }
.family-page-nav [data-family-section="social"] { --kingdom-icon: var(--kingdom-icon-members); }
.family-page-nav [data-family-section="honors"] { --kingdom-icon: var(--kingdom-icon-crown); }

.family-page-nav [data-family-section]::before,
.family-city-buildings button::before,
.family-home-hero .family-overview-metric > span:first-child::before,
.family-home-action-panels .family-home-disclosure > span::before,
.family-honor-tabs [data-honor-tab]::before {
  display: inline-block;
  flex: none;
  inline-size: var(--kingdom-icon-size, 17px);
  block-size: var(--kingdom-icon-size, 17px);
  background: currentColor;
  -webkit-mask: var(--kingdom-icon) center / contain no-repeat;
  mask: var(--kingdom-icon) center / contain no-repeat;
  content: '';
}

.family-campaign-slot .family-campaign {
  border-color: #c49c633d;
  background: radial-gradient(ellipse at 70% 120%, #295743, transparent 85%), #132e26;
  box-shadow: inset 0 1px 3px #091d17aa;
}

.family-page .card {
  border-color: var(--kingdom-line);
  background-color: var(--kingdom-paper);
  box-shadow: var(--kingdom-shadow);
}

.login-wrap .card,
.empty-kingdom .setup-card {
  border: 1px solid var(--kingdom-line);
  background: var(--kingdom-paper);
  box-shadow: var(--kingdom-shadow);
}

.login-wrap .brand-mark,
.empty-intro .empty-mark {
  border-color: var(--kingdom-gold);
  background: var(--kingdom-deep);
  color: #ffe6ad;
}

.empty-kingdom .empty-intro {
  border: 1px solid var(--kingdom-line);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--kingdom-paper), var(--kingdom-sand));
}

/* Home city and building shortcuts */
.family-overview.family-home-hero {
  grid-template-columns: minmax(0, 1fr) minmax(0, .9fr);
  border-color: var(--kingdom-line);
}

.family-home-hero .family-overview-showcase {
  grid-template-rows: minmax(0, 1fr) auto;
  background: #152f27;
}

.family-home-hero .family-overview-art img {
  block-size: 100%;
  object-fit: cover;
}

.family-home-hero .family-overview-art::after {
  background: linear-gradient(0deg, #10291f 0%, #132d23b8 15%, transparent 56%);
}

.family-home-hero .family-overview-overlay { padding-block-end: 12px; }
.family-home-hero .family-overview-identity h3 { text-shadow: 0 2px 7px #0d211a; }

#main .family-home-hero .family-overview-manage {
  --button-line: #e7c787a8;
  --button-bg: #163e32;
  --button-hover: #2b6049;
  --button-ink: #fff3d2;
  position: absolute;
  z-index: 2;
  inset-block-start: 10px;
  inset-inline-end: 10px;
}

.family-city-buildings {
  grid-area: 2 / 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border-block-start: 1px solid #b18f5285;
  background: #caa15d45;
}

.family-city-buildings button {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 5px;
  align-items: center;
  justify-content: center;
  min-block-size: 44px;
  padding: 6px 4px;
  border: 0;
  border-radius: 0;
  background: #1a3e32;
  color: #fef3d9;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.family-city-buildings button:hover { background: #2b6049; }
.family-city-buildings button:focus-visible { outline: 2px solid #ffd993; outline-offset: -3px; }
.family-city-buildings button::before { color: #ebc481; }
.family-city-buildings bdi { color: #ebc481; font-size: .82em; }
.family-city-buildings [data-city-building="palace"] { --kingdom-icon: var(--kingdom-icon-citadel); }
.family-city-buildings [data-city-building="barracks"] { --kingdom-icon: var(--kingdom-icon-shield); }
.family-city-buildings [data-city-building="workshop"] { --kingdom-icon: var(--kingdom-icon-forge); }

.family-home-hero .family-overview-summary {
  gap: 12px;
  background: linear-gradient(135deg, #fffaf0, #f9f0df);
}

.family-home-hero .family-overview-metrics {
  --kingdom-icon: var(--kingdom-icon-supply);
  --kingdom-icon-size: 15px;
  border: 1px solid #d7c7a9;
  background: #f0e7d5;
}

.family-home-hero .family-overview-metric + .family-overview-metric {
  --kingdom-icon: var(--kingdom-icon-shield);
  border-inline-start-color: #d5c5a7;
}

.family-home-hero .family-overview-metric > span:first-child {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #4b5748;
}

.family-home-hero .family-overview-metric > span:first-child::before { color: #79592d; }

.family-home-hero .family-overview-target {
  padding: clamp(10px, 1.6vw, 15px);
  border-color: #d8ba86;
  border-inline-start: 3px solid var(--kingdom-gold);
  background: linear-gradient(145deg, #fff8e7, #ecdfc3);
  box-shadow: inset 0 1px #fffdf7;
}

.family-home-hero .family-overview-target h4 { font-size: clamp(1.1rem, 3vw, 1.38rem); }
.family-home-hero > #family-home-more { border-block-start-color: var(--kingdom-line); }
.family-home-hero > #family-home-more > summary:hover { background: var(--kingdom-sand); }
.family-home-secondary > button:only-child { grid-column: 1 / -1; }

#family-home-activity { --kingdom-icon: var(--kingdom-icon-scroll); }
#family-home-buildings { --kingdom-icon: var(--kingdom-icon-forge); }
#family-home-members { --kingdom-icon: var(--kingdom-icon-members); }
#family-home-updates { --kingdom-icon: var(--kingdom-icon-letter); }

.family-home-action-panels .family-home-disclosure > span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.family-home-action-panels .family-home-disclosure > span::before { color: #8c652e; }
.family-home-action-panels .family-home-disclosure:hover,
.family-home-action-panels [open] > .family-home-disclosure { background: var(--kingdom-sand); }

.family-home-action-panels .family-building-option[aria-pressed="true"] {
  border-color: #a97d48;
  background: #f4ead5;
}

@media (max-width: 760px) {
  .family-home-hero .family-overview-art img { block-size: auto; }
  .family-home-hero .family-overview-overlay { gap: 4px; padding-block: 8px; }
  .family-home-hero .family-overview-summary { gap: 8px; }
}

@media (max-width: 390px) {
  .family-page-nav [data-family-section] { --kingdom-icon-size: 13px; }
  .family-city-buildings button { --kingdom-icon-size: 14px; }
}

/* The war table, province dossiers and dispatch results share the city palette. */
.conquest-layout .conquest-card,
.conquest-layout .province-detail {
  border-color: var(--kingdom-line);
  background: var(--kingdom-paper);
  box-shadow: var(--kingdom-shadow);
}

.conquest-layout .conquest-card .map-toolbar {
  flex-wrap: nowrap;
  align-items: center;
  border-block-end: 1px solid var(--kingdom-gold);
  background: linear-gradient(125deg, var(--kingdom-jade), var(--kingdom-deep) 72%);
  box-shadow: inset 0 1px #ffe5b528;
  color: var(--kingdom-paper);
}

.conquest-layout .map-toolbar-summary {
  display: flex;
  flex-direction: row;
  flex: 1 1 auto;
  align-items: center;
  min-inline-size: 0;
  gap: 8px;
  overflow-wrap: anywhere;
}

.conquest-layout .map-toolbar-summary::before {
  flex: none;
  inline-size: 11px;
  block-size: 11px;
  border: 1px solid var(--kingdom-gold-light);
  border-radius: 2px;
  background: radial-gradient(circle, var(--kingdom-gold-light) 0 24%, transparent 27%);
  transform: rotate(45deg);
  content: "";
}

.conquest-layout .map-toolbar-summary > b {
  line-height: 1.35;
}

.conquest-layout .conquest-card .conquest-map-controls .btn {
  border-color: #ddbd7b66;
  border-radius: 8px;
  background: #f4d5a014;
  box-shadow: inset 0 1px #fff3ce22;
  color: var(--kingdom-paper);
}

.conquest-layout .conquest-card .conquest-map-controls .btn:hover {
  background: #f4d5a02e;
}


.conquest-layout .conquest-routes {
  border-color: var(--kingdom-line);
  background: var(--kingdom-paper);
}

.conquest-layout #conquest-route-toggle {
  border-color: var(--kingdom-line);
  color: var(--kingdom-ink);
}

.conquest-layout .conquest-route-option,
.conquest-layout .conquest-route-metrics > div,
.conquest-layout #conquest-route-toggle > bdi,
.conquest-layout .province-road-links .text-btn{
  border-color: var(--kingdom-line);
  background: var(--kingdom-sand);
  color: var(--kingdom-ink);
}
.conquest-layout .conquest-route-option,
.conquest-layout :is(.conquest-route-metrics > div, #conquest-route-toggle > bdi),
.conquest-layout .province-road-links .text-btn {
  border-color: var(--kingdom-line);
  background: var(--kingdom-sand);
  color: var(--kingdom-ink);
}

.conquest-layout .province-detail .province-number {
  color: #74542c;
}

.conquest-layout .province-detail .detail-stat {
  border-color: var(--kingdom-line);
}

.conquest-layout .province-detail .province-art--isometric,
.conquest-layout .conquest-mobile-extra .province-art--isometric{
  border: 1px solid var(--kingdom-line);
  border-radius: 12px;
  background-color: var(--kingdom-sand);
}
.conquest-layout :is(.province-detail, .conquest-mobile-extra) .province-art--isometric {
  border: 1px solid var(--kingdom-line);
  border-radius: 12px;
  background-color: var(--kingdom-sand);
}

@media (max-width: 760px) {
  .conquest-layout .conquest-card .conquest-mobile-panel {
    --target-accent: var(--kingdom-gold);
    border-block-start-color: var(--target-accent);
    background: var(--kingdom-paper);
    color: var(--kingdom-ink);
  }

  .conquest-layout .conquest-card .conquest-mobile-panel[data-status="ready"],
.conquest-layout .conquest-card .conquest-mobile-panel[data-status="owned"]{
    --target-accent: var(--kingdom-jade);
  }
.conquest-layout .conquest-card .conquest-mobile-panel:is([data-status="ready"], [data-status="owned"]) {
    --target-accent: var(--kingdom-jade);
  }

  .conquest-layout .conquest-mobile-number,
  .conquest-layout .conquest-mobile-metrics > span {
    border: 1px solid var(--kingdom-line);
    background: var(--kingdom-sand);
    color: var(--kingdom-ink);
  }

  .conquest-layout .conquest-mobile-number {
    border-radius: 5px;
    font-variant-numeric: tabular-nums;
  }

  .conquest-layout .conquest-mobile-panel .conquest-dismiss {
    border-color: var(--kingdom-line);
    background: var(--kingdom-sand);
    color: var(--kingdom-deep);
  }

  .conquest-layout .conquest-mobile-extra {
    border-color: var(--kingdom-line);
  }
}

@media (max-width: 360px) {
  .conquest-layout .map-toolbar-summary { gap: 5px; }
  .conquest-layout .map-toolbar-summary::before { inline-size: 8px; block-size: 8px; }
}

/* Interaction, public family pages, and season honors */
[data-pve-view="families"] .family-card {
  display: grid;
  grid-template-areas: 'identity status' 'stats stats' 'open open';
  grid-template-columns: minmax(0, 1fr) minmax(0, max-content);
  align-items: center;
  gap: 12px;
  min-inline-size: 0;
  padding: clamp(12px, 2.1vw, 20px);
  border: 1px solid var(--kingdom-line);
  border-radius: 14px;
  background: linear-gradient(165deg, var(--kingdom-paper) 40%, var(--kingdom-sand));
  box-shadow: var(--kingdom-shadow);
}

[data-pve-view="families"] .family-card-identity {
  grid-area: identity;
  min-inline-size: 0;
  margin: 0;
  padding: 0;
}

[data-pve-view="families"] .family-card-name {
  min-block-size: 44px;
  text-align: start;
  color: var(--kingdom-ink);
}

[data-pve-view="families"] .family-card .status {
  position: static;
  grid-area: status;
  max-inline-size: 12ch;
  padding: 4px 8px;
  background: #e4ebdf;
  color: #2b5846;
  white-space: normal;
  text-align: center;
  overflow-wrap: normal;
}

[data-pve-view="families"] .family-card .status.gold {
  background: #ecdbb9;
  color: #67471d;
}

[data-pve-view="families"] .family-card .mini-stats {
  grid-area: stats;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding-block: 9px 0;
  border-block-start-color: var(--kingdom-line);
  overflow-wrap: anywhere;
}

[data-pve-view="families"] .mini-stats span {
  color: #625c4d;
  font-size: .7rem;
}

[data-pve-view="families"] .family-card > .btn {
  grid-area: open;
  min-inline-size: 0;
  min-block-size: 44px;
  white-space: normal;
}

body[data-pve-view="public"] .public-hero {
  --cover-fade: to right;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template: 'copy' / minmax(0, 1fr);
  align-items: end;
  overflow: hidden;
  min-block-size: clamp(300px, 37vw, 440px);
  padding: clamp(20px, 4vw, 48px);
  border: 1px solid var(--kingdom-gold);
  border-radius: 16px;
  background: var(--kingdom-deep);
  box-shadow: var(--kingdom-shadow);
}

:root[dir="rtl"] body[data-pve-view="public"] .public-hero { --cover-fade: to left; }

body[data-pve-view="public"] .public-hero .pve-hero-art {
  position: absolute;
  z-index: 0;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
}

body[data-pve-view="public"] .public-hero .pve-hero-art .pve-scene-image {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  object-position: center 42%;
}

body[data-pve-view="public"] .public-hero .pve-hero-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(var(--cover-fade), #142e25 7%, #142e25eb 36%, #142e2533 79%),
    linear-gradient(0deg, #142e25b8 0%, transparent 65%);
}

body[data-pve-view="public"] .public-hero .hero-copy {
  max-inline-size: min(100%, 34rem);
  padding: 0;
}

body[data-pve-view="public"] .public-hero .hero-copy .eyebrow,
body[data-pve-view="public"] .public-hero .hero-copy .hero-meta{ color: #f1d6a4; }
body[data-pve-view="public"] .public-hero .hero-copy :is(.eyebrow, .hero-meta) { color: #f1d6a4; }
body[data-pve-view="public"] .public-hero .hero-copy p { color: #fff1d7; }

body[data-pve-view="public"] .public-hero .hero-flag {
  inset: 10px auto auto;
  inset-inline-end: 10px;
  border-color: #e5c8958c;
  background: #15332aea;
  backdrop-filter: none;
  color: #f1d6a4;
}

body[data-pve-view="public"] .public-hero [data-copy-link] { box-shadow: inset 0 0 0 1px #e5c8958c; }

body[data-pve-view="public"] .public-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-color: var(--kingdom-line);
  background: var(--kingdom-line);
  box-shadow: var(--kingdom-shadow);
}

body[data-pve-view="public"] .public-metrics > div {
  padding: clamp(11px, 2vw, 19px) 8px;
  background: var(--kingdom-paper);
  overflow-wrap: anywhere;
}

body[data-pve-view="public"] .public-metrics span { color: #625c4d; }

body[data-pve-view="public"] .public-building.card,
body[data-pve-view="public"] .officer,
body[data-pve-view="public"] .grid-2 > .card{
  min-inline-size: 0;
  border: 1px solid var(--kingdom-line);
  border-radius: 13px;
  background: linear-gradient(165deg, var(--kingdom-paper), #f8f0e1);
  box-shadow: var(--kingdom-shadow);
  overflow-wrap: anywhere;
}
body[data-pve-view="public"] :is(.public-building.card, .officer, .grid-2 > .card) {
  min-inline-size: 0;
  border: 1px solid var(--kingdom-line);
  border-radius: 13px;
  background: linear-gradient(165deg, var(--kingdom-paper), #f8f0e1);
  box-shadow: var(--kingdom-shadow);
  overflow-wrap: anywhere;
}

body[data-pve-view="public"] .public-building .pve-public-building-art { background: #eee1c9; }
body[data-pve-view="public"] .officer { text-align: start; }
body[data-pve-view="public"] .officer small { color: #625c4d; }

.family-honor-tabs, .pk-tabs {
  border-color: var(--kingdom-line);
  border-radius: 12px;
  background: var(--kingdom-sand);
}

.family-honor-tabs button, .pk-tab { color: var(--kingdom-ink); }
.family-honor-tabs button:hover, .pk-tab:hover { background: #e9dbc1; }

.family-honor-tabs button[aria-pressed="true"], .pk-tab.is-active {
  border-color: var(--kingdom-deep);
  background: linear-gradient(160deg, var(--kingdom-jade), var(--kingdom-deep));
  color: #fff0cb;
  box-shadow: inset 0 -2px var(--kingdom-gold);
}

.family-honor-tabs [data-honor-tab] {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.family-honor-tabs [data-honor-tab="rankings"] { --kingdom-icon: var(--kingdom-icon-map); }
.family-honor-tabs [data-honor-tab="current"] { --kingdom-icon: var(--kingdom-icon-crown); }
.family-honor-tabs [data-honor-tab="history"] { --kingdom-icon: var(--kingdom-icon-scroll); }
.family-honor-tabs [data-honor-tab="pk"] { --kingdom-icon: var(--kingdom-icon-shield); }

.rankings-intro.card,
.ranking-empty.card,
.pk-result-list.card,
.pk-match-card.card,
.pk-lobby-empty.card,
.pk-empty.card,
.pk-audience.card,
.honor-archive-empty.card,
[data-pve-view="honor"] .honor-archive-card{
  border-color: var(--kingdom-line);
  background: linear-gradient(160deg, var(--kingdom-paper) 25%, #f5ebd8);
  box-shadow: var(--kingdom-shadow);
}
:is(.rankings-intro, .ranking-empty, .pk-result-list, .pk-match-card, .pk-lobby-empty, .pk-empty, .pk-audience, .honor-archive-empty).card,
[data-pve-view="honor"] .honor-archive-card {
  border-color: var(--kingdom-line);
  background: linear-gradient(160deg, var(--kingdom-paper) 25%, #f5ebd8);
  box-shadow: var(--kingdom-shadow);
}

.rankings-intro.card, [data-pve-view="honor"] .honor-archive-card { border-block-start: 2px solid var(--kingdom-gold); }
.rankings-intro b { color: var(--kingdom-ink); }
.rankings-intro p { color: #565646; }

.family-ranking-row {
  border-color: var(--kingdom-line);
  background: var(--kingdom-paper);
  box-shadow: var(--kingdom-shadow);
}

.family-ranking-row[data-ranking-position="1"] { border-color: #b48846; }
.family-ranking-row[data-ranking-position="2"] { border-color: #95a2a4; }
.family-ranking-row[data-ranking-position="3"] { border-color: #b78e70; }
.family-ranking-row .ranking-number { color: #635b46; }
.family-ranking-row[data-ranking-position="1"] .ranking-number { color: #75521d; }
.family-ranking-row[data-ranking-position="2"] .ranking-number { color: #465a61; }
.family-ranking-row[data-ranking-position="3"] .ranking-number { color: #775039; }

.family-ranking-row.ranking-is-self[data-ranking-own] {
  border-color: #82a08c;
  border-inline-start: 3px solid var(--kingdom-jade);
  background: #eef2e5;
  box-shadow: var(--kingdom-shadow);
}

:root[dir="rtl"] .family-ranking-row.ranking-is-self[data-ranking-own] { box-shadow: var(--kingdom-shadow); }

.family-ranking-row .ranking-family-link { text-align: start; }
.ranking-open { background: #efe5ce; color: #614b2d; }
.ranking-open:hover { background: #e7d7b4; color: var(--kingdom-ink); }
:root[dir="rtl"] .ranking-open { transform: scaleX(-1); }

.ranking-score strong { color: var(--kingdom-jade); }
.ranking-progress { max-inline-size: 100%; background: #e7ddc7; }
.ranking-progress i { background: var(--kingdom-jade); }
.ranking-complete .ranking-progress i { background: #98713a; }
.ranking-score strong small, .ranking-score > span, .ranking-reached > span, .rankings-list-heading h2 small, .rankings-list-heading > span { color: #625c4d; }

.family-honor-content .honor-grid--preview .honor-card--preview { border-radius: 14px; box-shadow: var(--kingdom-shadow); }
.family-honor-content .honor-card--preview::before { opacity: .65; }
.family-honor-content .honor-card--preview::after { opacity: .24; }
.honor-reward-rules > summary, .honor-season-picker select {
  border-color: var(--kingdom-line);
  border-radius: 10px;
  background: var(--kingdom-sand);
  color: var(--kingdom-ink);
}

.pk-audience { border-color: var(--kingdom-line); background: var(--kingdom-paper); }
.pk-result-row { border-block-end-color: var(--kingdom-line); }
.pk-phase-live { background: var(--kingdom-jade); }
.pk-arena { border-color: var(--kingdom-gold); }
.pk-tabs { min-inline-size: 0; }
.pk-tab { min-inline-size: 0; white-space: normal; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  body[data-pve-view="public"] .public-hero {
    min-block-size: clamp(288px, 70vw, 410px);
    padding: 76px 15px 16px;
  }

  body[data-pve-view="public"] .public-hero .pve-hero-art .pve-scene-image { object-position: center top; }

  body[data-pve-view="public"] .public-hero .pve-hero-art::after {
    background: linear-gradient(0deg, #142e25 8%, #142e25e8 40%, #142e2569 75%, #142e251f);
  }

  body[data-pve-view="public"] .public-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body[data-pve-view="public"] .public-hero .btn-row { flex-wrap: wrap; }
  .rankings-list-heading .ranking-jump-own { white-space: normal; }
}

@media (max-width: 380px) {
  [data-pve-view="families"] .family-card { gap: 8px; }
  [data-pve-view="families"] .family-card-identity { align-items: center; }
  body[data-pve-view="public"] .public-hero .btn-row .btn { flex: 1 1 auto; }
  .pk-result-row > div:last-child { flex-wrap: wrap; }
}

/* Shared dialogs, field reports and the kingdom’s formal notices. */
#modal {
  --modal-gutter: clamp(12px, 3.5vw, 22px);
  --modal-frame: #a98048;
  --modal-accent: var(--kingdom-gold-light);
  --modal-header: #235141;
  --modal-header-base: var(--kingdom-deep);
  box-sizing: border-box;
  inline-size: min(520px, calc(100% - 24px));
  max-block-size: calc(100vh - 32px);
  max-block-size:calc(100vh - 32px);max-block-size: calc(100dvh - 32px);
  padding: 0 var(--modal-gutter) var(--modal-gutter);
  border: 1px solid var(--modal-frame);
  border-radius: 16px;
  background: linear-gradient(160deg, var(--kingdom-paper) 45%, #f6eddd);
  color: var(--kingdom-ink);
  box-shadow: 0 20px 68px #10261f66, inset 0 0 0 1px #fff8e9;
  overscroll-behavior: contain;
}

#modal::backdrop {
  background: #101f1bd1;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

#modal > .modal-head {
  gap: 10px;
  min-block-size: 61px;
  margin: 0 calc(-1 * var(--modal-gutter)) var(--modal-gutter);
  padding: 8px var(--modal-gutter);
  border-block-end: 2px solid var(--modal-frame);
  border-start-start-radius: 15px;
  border-start-end-radius: 15px;
  background:
    repeating-linear-gradient(135deg, transparent 0 10px, #fdf1cd0a 10px 11px, transparent 11px 22px),
    linear-gradient(105deg, var(--modal-header), var(--modal-header-base));
  box-shadow: inset 0 1px #fff3d143, 0 3px 12px #51381e17;
  color: #fff5df;
}

#modal-title {
  min-inline-size: 0;
  margin: 0;
  color: inherit;
  font-size: clamp(1.03rem, 4vw, 1.26rem);
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

#modal > .modal-head .icon-button {
  flex: 0 0 44px;
  inline-size: 44px;
  block-size: 44px;
  padding: 0;
  border: 1px solid #f2dca654;
  border-radius: 9px;
  background: #101f1b49;
  color: var(--modal-accent);
  font-size: 1.48rem;
}

#modal > .modal-head .icon-button:hover { background: #101f1b8c; }
#modal > .modal-head .icon-button:focus-visible { outline: 2px solid #fff0ce; outline-offset: 2px; }
:root[data-family-input="pointer"] #modal:focus,
:root[data-family-input="pointer"] #modal > .modal-head [data-close]:focus { outline: none; }
/* The returned opener can be styled by a screen-specific ID selector. */
:root[data-family-input="pointer"] [data-family-dialog-return]:focus { outline: none !important; }
#modal-body { min-inline-size: 0; overflow-wrap: anywhere; }

#modal-body .form-note,
#modal-body .field small{
  color: #4c594c;
  font-size: .85rem;
  line-height: 1.6;
}
#modal-body :is(.form-note, .field small) {
  color: #4c594c;
  font-size: .85rem;
  line-height: 1.6;
}

#modal-body .form-note { margin-block-end: 12px; }
#modal-body .field > span { color: var(--kingdom-ink); font-size: .82rem; }

#modal-body .field input,
#modal-body .field select,
#modal-body .pk-modal-form input,
#modal-body .pk-modal-form select,
#modal-body .inline-input{
  min-block-size: 44px;
  max-inline-size: 100%;
  border: 1px solid #c4b392;
  border-radius: 8px;
  background-color: #fffdf6;
  color: var(--kingdom-ink);
  font-size: 1rem;
}
#modal-body :is(.field input, .field select, .pk-modal-form input, .pk-modal-form select, .inline-input) {
  min-block-size: 44px;
  max-inline-size: 100%;
  border: 1px solid #c4b392;
  border-radius: 8px;
  background-color: #fffdf6;
  color: var(--kingdom-ink);
  font-size: 1rem;
}

#modal-body .field input:focus-visible,
#modal-body .field select:focus-visible,
#modal-body .pk-modal-form input:focus-visible,
#modal-body .pk-modal-form select:focus-visible,
#modal-body .inline-input:focus-visible{
  outline: 2px solid var(--kingdom-jade);
  outline-offset: 2px;
}
#modal-body :is(.field input, .field select, .pk-modal-form input, .pk-modal-form select, .inline-input):focus-visible {
  outline: 2px solid var(--kingdom-jade);
  outline-offset: 2px;
}

#modal-body .stat-line {
  align-items: baseline;
  gap: 4px 10px;
  padding-block: 5px;
  border-block-end: 1px solid #e3d7bf;
  font-size: .84rem;
  line-height: 1.4;
}

#modal-body .stat-line span { color: #4c594c; }
#modal-body .stat-line b { text-align: end; font-variant-numeric: tabular-nums; }

#modal-body .notice {
  border-radius: 9px;
  font-size: .82rem;
  line-height: 1.55;
}

#modal-body .modal-actions {
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 16px;
  padding-block: 12px 0;
  border-block-start: 1px solid var(--kingdom-line);
}

#modal-body .modal-actions > .btn { min-inline-size: min(100%, 96px); min-block-size: 44px; }
#modal-body .modal-actions > .btn:not(.full) { flex-grow: 0; }
#modal-body .expedition-confirm-actions > .btn,
#modal-body .war-result-actions > .btn{ flex-grow: 1; }
#modal-body :is(.expedition-confirm-actions, .war-result-actions) > .btn { flex-grow: 1; }

#modal-body .modal-actions > .btn.gold {
  --button-bg: linear-gradient(#f0d198, #d6ad6d);
  --button-hover: #ecca8e;
  --button-line: #a98048;
  --button-ink: #3c281b;
}

#modal .modal-feedback { border-inline-start: 4px solid #b24932; box-shadow: 0 -5px 15px #fff9ed; }
[dir="rtl"] #modal .modal-feedback { border-left-width: 1px; }

#modal .expedition-confirm-metrics {
  gap: 0;
  border: 1px solid var(--kingdom-line);
  border-radius: 10px;
  background: #f0e3c9;
}

#modal .expedition-confirm-metrics > div {
  gap: 6px;
  padding-block: 12px;
  background: linear-gradient(#fffaf0, #f4ead6);
}

#modal .expedition-confirm-metrics > div + div { border-inline-start: 1px solid var(--kingdom-line); }
#modal .expedition-confirm-metrics span,
#modal .expedition-confirm-metrics b{ color: var(--kingdom-ink); }
#modal .expedition-confirm-metrics :is(span, b) { color: var(--kingdom-ink); }
#modal .expedition-confirm-metrics .expedition-risk { color: #923d2f; }

#modal .expedition-confirm-details {
  padding-inline: 10px;
  border: 1px solid var(--kingdom-line);
  border-radius: 9px;
  background: #fffdf6;
}

#modal .expedition-confirm-details[open] { padding-block-end: 9px; }
#modal .expedition-confirm-details > summary { color: var(--kingdom-deep); font-weight: 700; }
#modal .expedition-confirm-details > summary:focus-visible { outline-offset: -2px; }
#modal .expedition-confirm-warning { font-size: .82rem; line-height: 1.55; }

#modal.results-dialog { inline-size: min(580px, calc(100% - 24px)); }
#modal.war-results-dialog { inline-size: min(650px, calc(100% - 24px)); }
#modal.dispatch-results-dialog {
  --modal-frame: #9a7440;
  --modal-header: #6c4b2f;
  --modal-header-base: #44311f;
  inline-size: min(480px, calc(100% - 24px));
}

#modal.dispatch-results-dialog .modal-actions { inset-block-end: auto; background: none; }
#modal .rank-dispatch-card,
#modal .action-dispatch-card,
#modal .completion-card{
  box-shadow: inset 0 1px #fffdf4, 0 2px 5px #5c40110d;
}
#modal :is(.rank-dispatch-card, .action-dispatch-card, .completion-card) {
  box-shadow: inset 0 1px #fffdf4, 0 2px 5px #5c40110d;
}

#modal .rank-dispatch-card {
  border-inline-start-color: #9c623b;
  background: linear-gradient(120deg, #fffaf0, #f4e5cb);
}

#modal .action-dispatch-card {
  background: linear-gradient(115deg, #fffdf5, #f2ecde);
}

#modal .completion-card { border-color: var(--kingdom-line); background: #f8f4e6; }
#modal .completion-card.success { border-color: #a9b79b; background: #edf1e3; }
#modal .completion-card.failure { border-color: #d5b197; background: #f8ebde; }
#modal .completion-card small { color: #526455; }
#modal .completion-type { color: var(--kingdom-deep); }
#modal .completion-card.failure .completion-type { color: #803b2d; }
#modal .completion-symbol {
  border: 1px solid #b78e53;
  border-radius: 9px;
  background: linear-gradient(145deg, #316650, #193e33);
  color: #ffe7ad;
}

#modal .completion-card.failure .completion-symbol {
  border-color: #a36e51;
  background: #734631;
}

#modal.war-results-dialog .war-result-hero {
  border: 1px solid #a77b46;
  border-radius: 12px;
  box-shadow: 0 4px 13px #3f2f2036;
}

#modal.war-results-dialog .war-result-hero.unified {
  border-color: #d3a75e;
  box-shadow: 0 0 0 2px #dbb67438, 0 5px 14px #3f2f2040;
}

#modal.war-results-dialog .war-result-hero.defeat { border-color: #9a664b; }
#modal .battle-victory-progress { background: linear-gradient(105deg, #f3dfaa, #f9f1db 65%, #e8efe1); }
#modal .battle-result-numbers > div { border: 1px solid #d7cbb1; background: #fff9ed; }
#modal .battle-result-numbers span { color: #525e50; font-size: .75rem; }
#modal .battle-result-numbers > div:first-child strong { color: #8c4735; }
#modal .battle-result-numbers > div:last-child strong { color: var(--kingdom-jade); }
#modal .battle-result-breakdown { color: #525e50; font-size: .75rem; }

.family-page-sticky #result-notice {
  border-block-end-color: #c7a572;
  box-shadow: inset 0 1px #ffffff85, 0 2px 4px #2d231718;
}

.family-page-sticky #result-notice .result-notice-icon {
  border-radius: 8px;
  box-shadow: inset 0 1px #fffdf4;
}

@media (max-width: 420px) {
  #modal-body .modal-actions > .btn:not(.full) { flex: 1 1 104px; }
  #modal > .modal-head { min-block-size: 55px; padding-block: 5px; }
}

@media (max-height: 480px) {
  #modal { max-block-size: calc(100vh - 16px); max-block-size:calc(100vh - 16px);max-block-size: calc(100dvh - 16px); }
}
