/* === Requiem Calc Database v51 portal/layout === */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}
body {
  background: #000 !important;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.74) 62%, #000 100%),
    url("assets/ui/site_bg.png") center top / cover no-repeat;
}
/* ---- Portal shell: page frame ----------------------------------------------- */

.portal-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* ---- Portal shell: header / brand -------------------------------------------- */

.portal-header {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 14px 12px 10px;
  position: relative;
  z-index: 20;
}
.portal-header-inner {
  width: min(1180px, calc(100vw - 24px));
  padding: 20px 22px 18px;
  position: relative;
  border: 1px solid rgba(254, 207, 125, 0.3);
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(34, 17, 15, 0.97), rgba(6, 6, 8, 0.95));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.85),
    0 0 38px rgba(0, 0, 0, 0.78),
    inset 0 0 42px rgba(155, 44, 18, 0.22);
}
.portal-header-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 0%, rgba(254, 207, 125, 0.17), transparent 42%);
  border-radius: inherit;
}
.portal-brand {
  position: relative;
  text-align: center;
  margin-bottom: 16px;
}
.portal-kicker {
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #bfa982;
}
.portal-title {
  font-family: "Cinzel Decorative", "Cinzel", "Trajan Pro", Georgia, serif;
  font-size: 36px;
  line-height: 1.03;
  font-weight: 900;
  letter-spacing: 0.085em;
  text-transform: uppercase;
  color: #fecf7d;
  text-shadow:
    0 1px 0 #000,
    0 0 10px rgba(254, 207, 125, 0.42),
    0 0 28px rgba(180, 45, 18, 0.55);
}
.portal-subtitle {
  margin-top: 7px;
  color: #d1d1d1;
  font-size: 14px;
}
/* ---- Portal shell: top navigation -------------------------------------------- */

.portal-nav {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.portal-nav button {
  height: 42px;
  min-width: 150px;
  padding: 0 16px;
  border-radius: 5px;
  border: 1px solid rgba(254, 207, 125, 0.36);
  background: linear-gradient(180deg, #3a201a, #120f12);
  color: #fecf7d;
  font-weight: 900;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.55),
    0 0 14px rgba(0, 0, 0, 0.42);
  text-shadow: 0 1px 0 #000;
}
.portal-nav button:hover,
.portal-nav button.active {
  border-color: rgba(254, 207, 125, 0.95);
  background: linear-gradient(180deg, #5a2b1e, #1a1215);
  box-shadow:
    0 0 16px rgba(254, 207, 125, 0.24),
    inset 0 0 18px rgba(170, 60, 25, 0.42);
}
/* ---- Portal shell: page container & generic tool-page styles ---------------- */

.portal-pages {
  width: 100%;
  display: flex;
  justify-content: center;
  position: relative;
}
.portal-page {
  width: 100%;
  display: none;
}
.portal-page.active {
  display: block;
}
.portal-home,
.tool-page {
  width: min(1180px, calc(100vw - 24px));
  margin: 0 auto 24px;
}
.home-card,
.tool-panel {
  border: 1px solid rgba(254, 207, 125, 0.2);
  background: linear-gradient(180deg, rgba(13, 10, 11, 0.94), rgba(4, 4, 6, 0.94));
  box-shadow:
    0 0 30px rgba(0, 0, 0, 0.68),
    inset 0 0 28px rgba(120, 36, 19, 0.14);
  border-radius: 5px;
  padding: 22px;
}
.hero-card {
  text-align: center;
  margin-bottom: 14px;
}
.hero-card h1,
.tool-panel h1 {
  font-family: "Cinzel Decorative", "Cinzel", "Trajan Pro", Georgia, serif;
  letter-spacing: 0.065em;
  text-transform: uppercase;
  font-size: 26px;
  margin: 0 0 10px;
  color: #fecf7d;
}
.hero-card p,
.portal-muted {
  color: #d1d1d1;
  line-height: 1.45;
}
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.feature-card {
  height: 112px !important;
  min-width: 0 !important;
  text-align: left;
  padding: 16px;
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  cursor: pointer;
  background: linear-gradient(180deg, #20181a, #0d0d11);
  border: 1px solid rgba(254, 207, 125, 0.28);
  color: #fecf7d;
  border-radius: 4px;
  white-space: normal;
}
.feature-card:hover {
  border-color: rgba(254, 207, 125, 0.78);
  background: linear-gradient(180deg, #332022, #151319);
  box-shadow:
    0 0 12px rgba(254, 207, 125, 0.18),
    inset 0 0 16px rgba(120, 36, 19, 0.42);
}
.feature-card b {
  font-size: 18px;
}
.feature-card span {
  display: block;
  color: #d1d1d1;
  font-size: 13px;
  line-height: 1.35;
}
.skill-page.active {
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
}
#page-skills.active .app {
  transform: none;
}
.tool-panel {
  margin: 0 auto;
  max-width: 960px;
}
.tool-panel.wide {
  max-width: 1120px;
}
.coming-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.coming-list span {
  padding: 9px 12px;
  border: 1px solid rgba(254, 207, 125, 0.2);
  background: rgba(0, 0, 0, 0.28);
  border-radius: 3px;
  color: #d8c49e;
}
.db-search {
  margin: 10px 0 14px;
  width: 100%;
  height: 34px;
  border-color: rgba(254, 207, 125, 0.28);
  background: #101014;
}
/* ---- Items DB (early preview) ------------------------------------------------ */

.db-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}
.db-card {
  border: 1px solid rgba(254, 207, 125, 0.18);
  background: rgba(0, 0, 0, 0.3);
  padding: 11px;
  border-radius: 3px;
}
.db-card b {
  display: block;
  color: #fecf7d;
  font-size: 15px;
  margin-bottom: 2px;
}
.db-card small {
  display: block;
  color: #9f927d;
  margin-bottom: 7px;
}
.db-card p {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}
.db-card p span {
  font-size: 12px;
  color: #d1d1d1;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  padding: 3px 5px;
  border-radius: 2px;
}
.planner-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}
.paper-doll,
.stat-preview {
  min-height: 300px;
  border: 1px solid rgba(254, 207, 125, 0.18);
  background:
    radial-gradient(circle at 50% 22%, rgba(254, 207, 125, 0.08), transparent 45%),
    rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  padding: 18px;
  display: grid;
  gap: 10px;
  align-content: center;
}
.paper-doll span,
.stat-preview span {
  border: 1px solid rgba(254, 207, 125, 0.18);
  background: rgba(12, 12, 16, 0.74);
  padding: 10px;
  text-align: center;
  color: #d1d1d1;
}
.stat-preview b {
  text-align: center;
  font-size: 18px;
  color: #fecf7d;
  margin-bottom: 4px;
}
.portal-footer {
  width: min(1180px, calc(100vw - 24px));
  margin: 18px auto 34px;
  padding: 16px 18px;
  text-align: center;
  color: var(--sub);
  border-top: 1px solid rgba(254, 207, 125, 0.2);
  background: linear-gradient(180deg, rgba(8, 8, 10, 0.52), rgba(0, 0, 0, 0.18));
}
.portal-footer .footer-title {
  font-family: "Cinzel Decorative", "Cinzel", "Trajan Pro", Georgia, serif;
  color: #fecf7d;
  font-size: 18px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.portal-footer .footer-line {
  margin-top: 5px;
}
.portal-footer .footer-sub {
  margin-top: 5px;
  color: rgba(209, 209, 209, 0.66);
  font-size: 12px;
}
@media (max-width: 760px) {
  .portal-title {
    font-size: 25px;
  }
  .portal-nav button {
    min-width: calc(50% - 8px);
  }
  .planner-layout {
    grid-template-columns: 1fr;
  }
  .portal-header-inner,
  .portal-home,
  .tool-page,
  .portal-footer {
    width: calc(100vw - 16px);
  }
}

/* === EXP Calculator v51 === */
/* ---- EXP Calculator: tool panel ----------------------------------------------- */

.exp-tool {
  max-width: 840px !important;
  width: min(840px, calc(100vw - 24px));
  padding: 18px;
}
.exp-tool h2 {
  margin: 0 0 8px;
  color: #fecf7d;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
/* ---- EXP Calculator: control fieldsets ---------------------------------------- */

.exp-controls.compact {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.exp-controls fieldset {
  border: 1px solid rgba(254, 207, 125, 0.18);
  background: rgba(0, 0, 0, 0.22);
  padding: 9px;
  margin: 0;
  min-width: 0;
}
.exp-controls legend {
  color: #fecf7d;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0 5px;
}
.exp-controls label,
/* ---- EXP Calculator: server-rate grid ----------------------------------------- */

.zone-rate-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #d1d1d1;
  font-weight: 700;
  font-size: 12px;
  position: relative;
}
.exp-controls input,
.zone-rate-grid input,
.completed-row textarea {
  width: 100%;
  height: 28px;
  background: #101014;
  color: #fecf7d;
  border: 1px solid rgba(254, 207, 125, 0.28);
  font-size: 12px;
}
.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 4px;
  border: 1px solid rgba(254, 207, 125, 0.45);
  border-radius: 50%;
  font-size: 11px;
  color: #fecf7d;
  cursor: help;
}
.field-tooltip {
  display: none;
  position: absolute;
  left: 0;
  top: 33px;
  z-index: 40;
  width: 250px;
  padding: 8px;
  border: 1px solid rgba(254, 207, 125, 0.35);
  background: #09090c;
  color: #d1d1d1;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.72);
  line-height: 1.35;
}
.help-tip:hover + .field-tooltip,
.help-tip:focus + .field-tooltip {
  display: block;
}
.exp-controls .checkline {
  flex-direction: row;
  align-items: center;
  gap: 7px;
  padding-top: 11px;
}
.exp-controls .checkline input {
  width: auto;
  height: auto;
}
.rate-panel,
/* ---- EXP Calculator: completed quests / progress / quest-level tables -------- */

.completed-panel,
.player-progress-panel,
.quest-levels-panel {
  border: 1px solid rgba(254, 207, 125, 0.18);
  background: rgba(0, 0, 0, 0.24);
  padding: 12px;
  margin: 11px 0;
  border-radius: 4px;
}
.zone-rate-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}
.zone-rate-grid label {
  min-width: 0;
  justify-content: end;
}
.zone-rate-grid label span {
  min-height: 28px;
  display: flex;
  align-items: end;
  line-height: 1.15;
}
.zone-rate-grid small {
  color: #8f887a;
  font-size: 10px;
  min-height: 12px;
}
.percent-input {
  display: flex;
  align-items: center;
  gap: 4px;
}
.percent-input input {
  width: 68px;
  max-width: 68px;
  text-align: right;
}
.percent-input em {
  font-style: normal;
  color: #d1d1d1;
}
.completed-row {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 8px;
  align-items: stretch;
}
.completed-row textarea {
  min-height: 60px;
  padding: 7px;
  resize: vertical;
}
.completed-buttons {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.completed-buttons button,
.mini-actions button {
  height: 29px;
  min-width: 90px;
  font-size: 12px;
}
.exp-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.summary-card {
  border: 1px solid rgba(254, 207, 125, 0.2);
  background: linear-gradient(180deg, rgba(26, 18, 18, 0.72), rgba(0, 0, 0, 0.34));
  padding: 10px;
  border-radius: 4px;
  text-align: center;
}
.summary-card b {
  display: block;
  color: #00ff39;
  font-size: 16px;
}
.summary-card span {
  display: block;
  color: #d1d1d1;
  font-size: 11px;
  margin-top: 3px;
}
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.section-title-row h2 {
  margin: 0;
}
.mini-actions {
  display: flex;
  gap: 6px;
}
.player-level-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid rgba(254, 207, 125, 0.1);
  padding: 7px 0;
}
.player-level-row.empty {
  opacity: 0.62;
}
.level-badge {
  font-weight: 800;
  color: #fecf7d;
  text-align: center;
  border: 1px solid rgba(254, 207, 125, 0.22);
  padding: 7px 0;
  background: rgba(0, 0, 0, 0.22);
  font-size: 12px;
}
.bar {
  height: 10px;
  border: 1px solid rgba(254, 207, 125, 0.22);
  background: #09090c;
  position: relative;
  overflow: hidden;
  border-radius: 2px;
}
.bar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 calc(3.333% - 1px),
    rgba(209, 209, 209, 0.32) calc(3.333% - 1px) 3.333%
  );
}
.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(58, 56, 96, 0.8),
    rgba(78, 75, 119, 0.74),
    rgba(105, 100, 150, 0.72)
  );
  box-shadow: 0 0 8px rgba(78, 75, 119, 0.45);
}
.bar-text {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  color: #d1d1d1;
  font-size: 11px;
}
.bar-left {
  display: flex;
  gap: 10px;
  align-items: center;
}
.bar-left b {
  color: #fecf7d;
}
.bar-surplus {
  margin-left: auto;
  text-align: right;
}
.bar-surplus.positive {
  color: #00ff39;
}
.bar-surplus.negative {
  color: #6db8ff;
}
.quest-level-block {
  border: 1px solid rgba(254, 207, 125, 0.13);
  margin: 7px 0;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 3px;
  overflow: hidden;
}
.quest-level-header {
  width: 100%;
  height: 34px;
  display: grid;
  grid-template-columns: 1fr 88px 130px;
  gap: 8px;
  align-items: center;
  text-align: left;
  background: linear-gradient(180deg, rgba(32, 24, 26, 0.9), rgba(12, 12, 15, 0.9));
  border: 0;
  border-bottom: 1px solid rgba(254, 207, 125, 0.12);
  color: #fecf7d;
  padding: 0 10px;
}
.quest-level-header:hover {
  background: linear-gradient(180deg, rgba(48, 32, 34, 0.94), rgba(18, 16, 20, 0.94));
}
.quest-level-header b,
.quest-level-header em {
  text-align: right;
  font-style: normal;
  color: #d1d1d1;
  font-size: 12px;
}
.quest-level-body {
  display: grid;
  gap: 5px;
  padding: 7px;
}
.quest-chain-group {
  position: relative;
  display: grid;
  gap: 5px;
  padding-left: 14px;
}
.quest-chain-group::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 7px;
  bottom: 7px;
  width: 10px;
  border-left: 2px solid rgba(209, 209, 209, 0.48);
  border-top: 2px solid rgba(209, 209, 209, 0.48);
  border-bottom: 2px solid rgba(209, 209, 209, 0.48);
}
.quest-row {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr 120px 120px 98px 58px;
  gap: 7px;
  align-items: center;
  border: 1px solid rgba(254, 207, 125, 0.12);
  background: rgba(0, 0, 0, 0.28);
  padding: 6px 7px;
  border-radius: 3px;
  color: #d1d1d1;
}
.quest-row.done {
  opacity: 0.55;
}
.quest-title {
  color: #fecf7d;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quest-type {
  color: #d1d1d1;
  font-size: 11px;
}
.quest-zone {
  color: #bcae91;
  font-size: 11px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quest-xp {
  color: #00ff39;
  text-align: right;
  font-size: 12px;
}
.quest-id {
  color: #777;
  text-align: right;
  font-size: 11px;
}
@media (max-width: 860px) {
  .exp-tool {
    width: calc(100vw - 16px) !important;
  }
  .exp-controls.compact {
    grid-template-columns: 1fr 1fr;
  }
  .zone-rate-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .exp-summary {
    grid-template-columns: 1fr 1fr;
  }
  .completed-row {
    grid-template-columns: 1fr;
  }
  .quest-row {
    grid-template-columns: 22px 1fr;
  }
  .quest-type,
  .quest-zone,
  .quest-xp,
  .quest-id {
    grid-column: 2;
    text-align: left;
  }
  .quest-title {
    white-space: normal;
  }
  .section-title-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .quest-level-header {
    grid-template-columns: 1fr;
  }
  .bar-text {
    flex-direction: column;
  }
  .bar-surplus {
    text-align: left;
    margin-left: 0;
  }
}

/* === Requiem Calc Database v52 requested tweaks === */
.legend-with-help {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
}
.legend-with-help .field-tooltip {
  left: auto;
  right: -8px;
  top: -58px;
}
.help-tip:hover + .field-tooltip,
.help-tip:focus + .field-tooltip {
  display: block;
}
.option-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 9px;
  color: #d1d1d1;
  font-weight: 800;
}
.option-toggle input {
  width: auto;
  height: auto;
}
.bar-surplus.positive {
  color: #fecf7d;
}
.bar-surplus.negative {
  color: #6db8ff;
}

/* === Requiem Calc Database v53 home/nav/options polish === */
.portal-header-inner {
  padding-bottom: 20px;
}
.portal-nav {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  width: 100%;
  margin-top: 4px;
}
.portal-nav button {
  width: 100%;
  min-width: 0;
  height: 48px;
  font-size: 14px;
  letter-spacing: 0.045em;
}
.portal-nav button[data-page="home"] {
  background: linear-gradient(180deg, #4b1717, #160808);
  border-color: rgba(190, 70, 70, 0.75);
  box-shadow:
    inset 0 0 14px rgba(0, 0, 0, 0.55),
    0 0 8px rgba(0, 0, 0, 0.28);
}
.portal-nav button[data-page="home"].active,
.portal-nav button[data-page="home"]:hover {
  background: linear-gradient(180deg, #6b2020, #1b0909);
  border-color: rgba(254, 207, 125, 0.7);
  box-shadow:
    inset 0 0 16px rgba(90, 20, 20, 0.34),
    0 0 8px rgba(0, 0, 0, 0.34);
}

.portal-home {
  width: min(900px, calc(100vw - 24px));
}
/* ---- Home page: changelog ----------------------------------------------------- */

.changelog-card {
  border: 1px solid rgba(254, 207, 125, 0.22);
  background: linear-gradient(180deg, rgba(13, 10, 11, 0.94), rgba(4, 4, 6, 0.94));
  box-shadow:
    0 0 30px rgba(0, 0, 0, 0.68),
    inset 0 0 28px rgba(120, 36, 19, 0.14);
  border-radius: 5px;
  padding: 22px;
}
.changelog-head {
  text-align: center;
  border-bottom: 1px solid rgba(254, 207, 125, 0.16);
  padding-bottom: 12px;
  margin-bottom: 12px;
}
.changelog-head h1 {
  font-family: "Cinzel Decorative", "Cinzel", "Trajan Pro", Georgia, serif;
  color: #fecf7d;
  letter-spacing: 0.085em;
  text-transform: uppercase;
  margin: 0 0 6px;
  font-size: 28px;
}
.changelog-head p {
  margin: 0;
  color: #d1d1d1;
}
.changelog-list {
  display: grid;
  gap: 10px;
}
.changelog-list article {
  border: 1px solid rgba(254, 207, 125, 0.14);
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  padding: 12px 14px;
}
.changelog-list h2 {
  margin: 0 0 8px;
  color: #fecf7d;
  font-size: 15px;
}
.changelog-list ul {
  margin: 0;
  padding-left: 18px;
  color: #d1d1d1;
  line-height: 1.45;
}
.changelog-list li {
  margin: 2px 0;
}

.section-title-with-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.section-title-with-help .field-tooltip {
  left: auto;
  right: -8px;
  top: -58px;
}
.legend-with-help .field-tooltip {
  left: auto;
  right: -8px;
  top: -58px;
}
.exp-controls fieldset:last-child .checkline {
  padding-top: 4px;
}
.exp-controls fieldset:last-child .checkline:first-of-type {
  padding-top: 8px;
}

@media (max-width: 900px) {
  .portal-nav {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* === Requiem Calc Database v54 footer logo === */
.footer-logo {
  display: block;
  width: min(420px, 70vw);
  height: auto;
  margin: 0 auto 8px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 12px rgba(120, 0, 0, 0.28));
}
.portal-footer .footer-title {
  margin-top: 0;
}

/* ============================================================
   Equipment Planner
   ============================================================ */

/* --- Tool container --- */
