:root {
  --ch-gold: #d6a13a;
  --ch-gold-light: #f1cf73;
  --ch-navy: #061421;
  --ch-navy-soft: #0b2233;
  --ch-red: #5f170f;
  --ch-ink: #03080d;
}

.ch-dashboard-surface {
  position: relative;
  isolation: isolate;
  background-color: #030a10;
  background-image:
    linear-gradient(rgb(1 5 8 / 18%), rgb(1 5 8 / 52%)),
    url("./ambient/background-texture.png");
  background-repeat: repeat;
  background-size: auto, 627px 627px;
  overflow: hidden;
}

.ch-dashboard-surface > *:not(.ch-ambient) {
  position: relative;
  z-index: 2;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.ch-panel {
  --frame-x: clamp(42px, 5vw, 78px);
  --frame-y: clamp(38px, 4.5vw, 70px);

  position: relative;
  min-width: 0;
  padding: clamp(14px, 2.2vw, 32px);
  border-style: solid;
  border-width: var(--frame-y) var(--frame-x);
  border-image-source: url("./panel-frame-9slice.png");
  border-image-slice: 230 fill;
  border-image-width: 1;
  border-image-repeat: stretch;
  background:
    radial-gradient(circle at 50% 15%, rgb(20 50 69 / 45%), transparent 46%),
    linear-gradient(145deg, #0a1b28, var(--ch-ink));
  color: #ead9ad;
  isolation: isolate;
}

.ch-panel > * {
  position: relative;
  z-index: 1;
}

.ch-title-plaque {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  min-height: clamp(54px, 7vw, 82px);
  padding: 8px clamp(38px, 7vw, 92px);
  border-style: solid;
  border-width: 16px clamp(48px, 7vw, 88px);
  border-image-source: url("./title-plaque-9slice.png");
  border-image-slice: 58 330 fill;
  border-image-width: 1;
  border-image-repeat: stretch;
  color: var(--ch-gold-light);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 2.6vw, 2rem);
  letter-spacing: 0.055em;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 2px 3px #000;
}

.ch-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(100%, 210px);
  min-height: 58px;
  padding: 7px clamp(30px, 5vw, 68px);
  border-style: solid;
  border-width: 14px clamp(42px, 6vw, 66px);
  border-image-source: url("./nav-button.png");
  border-image-slice: 52 360 fill;
  border-image-width: 1;
  border-image-repeat: stretch;
  background: transparent;
  color: var(--ch-gold-light);
  cursor: pointer;
  font: 700 clamp(0.78rem, 1.7vw, 1rem)/1.1 Georgia, "Times New Roman", serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 2px 3px #000;
  transition: filter 160ms ease, transform 160ms ease;
}

.ch-button:hover,
.ch-button:focus-visible {
  filter: brightness(1.2) drop-shadow(0 0 8px rgb(225 171 61 / 42%));
  outline: none;
  transform: translateY(-2px);
}

.ch-button:active {
  filter: brightness(0.92);
  transform: translateY(1px);
}

.ch-medallion {
  display: grid;
  place-items: center;
  width: clamp(116px, 22vw, 250px);
  aspect-ratio: 1;
  margin-inline: auto;
  padding: 25%;
  background: url("./medallion-frame.png") center / contain no-repeat;
  color: var(--ch-gold-light);
  text-align: center;
}

.ch-crest {
  display: block;
  width: clamp(120px, 20vw, 260px);
  height: auto;
  margin-inline: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 15px rgb(0 0 0 / 42%));
}

.ch-paw-badge {
  display: block;
  width: clamp(44px, 7vw, 88px);
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 5px 6px rgb(0 0 0 / 38%));
}

.ch-wax-seal {
  display: block;
  width: clamp(54px, 9vw, 108px);
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 7px 8px rgb(0 0 0 / 34%));
}

.ch-navigation {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: clamp(8px, 2vw, 18px);
  width: 100%;
}

.ch-kpi-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 1px;
  padding: 8px;
  border: 1px solid #805b20;
  background: linear-gradient(180deg, #102536, #06111b);
  box-shadow: inset 0 0 0 2px #02070b, 0 10px 22px rgb(0 0 0 / 30%);
}

.ch-kpi {
  display: grid;
  grid-template-columns: clamp(42px, 5vw, 62px) 1fr;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 6px 12px;
  border-right: 1px solid rgb(203 151 55 / 28%);
}

.ch-kpi:last-child {
  border-right: 0;
}

.ch-kpi__icon {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 4px 4px rgb(0 0 0 / 50%));
}

.ch-kpi__label,
.ch-kpi__value {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
}

.ch-kpi__label {
  color: #d2a74c;
  font-size: clamp(0.63rem, 1.2vw, 0.83rem);
  text-transform: uppercase;
}

.ch-kpi__value {
  color: #edcf86;
  font-size: clamp(1rem, 2vw, 1.45rem);
}

.ch-command {
  display: grid;
  grid-template-columns: minmax(260px, 430px) minmax(260px, 1fr);
  align-items: center;
  gap: clamp(16px, 4vw, 54px);
  width: min(980px, 100%);
  margin: clamp(20px, 4vw, 44px) auto;
}

.ch-portrait-ring {
  --progress: 76;
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 420px);
  aspect-ratio: 1;
  margin-inline: auto;
  padding: clamp(14px, 2vw, 22px);
  border: clamp(7px, 1.2vw, 13px) solid #8b6628;
  border-radius: 50%;
  background: conic-gradient(
    #51bcec calc(var(--progress) * 1%),
    #1d303c 0
  );
  box-shadow:
    inset 0 0 0 5px #e0ad45,
    inset 0 0 35px #000,
    0 18px 35px rgb(0 0 0 / 45%);
}

.ch-portrait-ring::before {
  content: "";
  position: absolute;
  inset: clamp(18px, 2.5vw, 27px);
  border: 3px solid #c59034;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 28%, #123146, #02070b 68%);
}

.ch-portrait {
  position: relative;
  z-index: 1;
  width: 105%;
  height: 105%;
  object-fit: contain;
  animation: ch-breathe 4.6s ease-in-out infinite;
  transform-origin: 50% 80%;
}

.ch-portrait-level {
  position: absolute;
  z-index: 3;
  bottom: -8px;
  left: 50%;
  min-width: 86px;
  padding: 7px 16px;
  border: 2px solid #d6a13a;
  background: linear-gradient(#173047, #07131d);
  color: #efca6a;
  font: 700 1rem/1 Georgia, serif;
  text-align: center;
  transform: translateX(-50%);
  clip-path: polygon(12% 0, 88% 0, 100% 50%, 88% 100%, 12% 100%, 0 50%);
}

.ch-command__message {
  display: grid;
  gap: 16px;
}

.ch-parchment {
  display: grid;
  align-content: center;
  min-height: clamp(150px, 23vw, 230px);
  padding: clamp(34px, 6vw, 72px) clamp(42px, 8vw, 96px);
  background: url("./ambient/parchment.png") center / 100% 100% no-repeat;
  color: #3c2415;
  font: clamp(0.9rem, 1.8vw, 1.15rem)/1.45 Georgia, serif;
  text-align: center;
  text-shadow: 0 1px #fff5d2;
}

.ch-parchment strong {
  color: #6d1a10;
}

.ch-content-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
  vertical-align: middle;
  filter: drop-shadow(0 3px 3px rgb(0 0 0 / 45%));
}

.ch-medals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: clamp(8px, 1.8vw, 18px);
  width: 100%;
}

.ch-medal {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  color: #caa354;
  font: 700 0.67rem/1.15 Georgia, serif;
  text-align: center;
  text-transform: uppercase;
}

.ch-medal img {
  width: min(100%, 126px);
  height: auto;
  transition: filter 180ms ease, transform 180ms ease;
}

.ch-medal:hover img {
  filter: brightness(1.15) drop-shadow(0 0 10px rgb(230 177 65 / 35%));
  transform: translateY(-4px);
}

.ch-medal--locked {
  color: #77736b;
}

.ch-ambient {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  user-select: none;
}

.ch-lantern {
  top: 18%;
  right: clamp(-70px, -3vw, -22px);
  width: clamp(90px, 12vw, 170px);
  filter: drop-shadow(0 0 22px rgb(242 157 45 / 28%));
  animation: ch-flicker 3.2s ease-in-out infinite;
}

.ch-foliage {
  right: -3%;
  bottom: -2%;
  width: min(56vw, 700px);
  opacity: 0.35;
}

@keyframes ch-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.012); }
}

@keyframes ch-flicker {
  0%, 100% { filter: brightness(0.96) drop-shadow(0 0 18px rgb(242 157 45 / 25%)); }
  36% { filter: brightness(1.12) drop-shadow(0 0 30px rgb(242 157 45 / 42%)); }
  52% { filter: brightness(1.02) drop-shadow(0 0 22px rgb(242 157 45 / 31%)); }
  78% { filter: brightness(1.17) drop-shadow(0 0 33px rgb(242 157 45 / 45%)); }
}

.ch-nav-item {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #d8b566;
  cursor: pointer;
  font: 700 0.72rem/1.15 Georgia, "Times New Roman", serif;
  letter-spacing: 0.025em;
  text-align: center;
  text-transform: uppercase;
}

.ch-nav-item__medallion {
  display: grid;
  place-items: center;
  width: clamp(78px, 10vw, 112px);
  aspect-ratio: 1;
  background: url("./medallion-frame.png") center / contain no-repeat;
  transition: filter 160ms ease, transform 160ms ease;
}

.ch-nav-item__icon {
  width: 52%;
  height: 52%;
  object-fit: contain;
  filter: drop-shadow(0 4px 4px rgb(0 0 0 / 55%));
}

.ch-nav-item:hover .ch-nav-item__medallion,
.ch-nav-item:focus-visible .ch-nav-item__medallion,
.ch-nav-item[aria-current="page"] .ch-nav-item__medallion {
  filter: brightness(1.2) drop-shadow(0 0 10px rgb(235 184 70 / 42%));
  transform: translateY(-3px) scale(1.025);
}

.ch-nav-item:focus-visible {
  outline: 1px solid var(--ch-gold-light);
  outline-offset: 4px;
}

.ch-divider {
  display: grid;
  grid-template-columns: 38px minmax(16px, 1fr) 58px minmax(16px, 1fr) 38px;
  align-items: center;
  width: 100%;
  height: 34px;
}

.ch-divider__cap,
.ch-divider__center,
.ch-divider__line {
  display: block;
  height: 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.ch-divider__cap--left {
  background-image: url("./divider-cap-left.png");
}

.ch-divider__cap--right {
  background-image: url("./divider-cap-right.png");
}

.ch-divider__center {
  background-image: url("./divider-center.png");
}

.ch-divider__line {
  background-image: url("./divider-line.png");
  background-repeat: repeat-x;
  background-size: auto 100%;
}

@media (max-width: 560px) {
  .ch-panel {
    --frame-x: 34px;
    --frame-y: 34px;
    padding: 12px;
  }

  .ch-title-plaque {
    padding-inline: 34px;
    border-inline-width: 40px;
  }

  .ch-button {
    width: 100%;
    border-inline-width: 38px;
  }

  .ch-kpi-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  .ch-kpi:nth-child(2) {
    border-right: 0;
  }

  .ch-command {
    grid-template-columns: 1fr;
  }

  .ch-parchment {
    padding: 34px 38px;
  }

  .ch-lantern {
    opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ch-portrait,
  .ch-lantern,
  .ch-nav-item__medallion,
  .ch-medal img,
  .ch-button {
    animation: none;
    transition: none;
  }
}
