:root {
  --portal-ink: #35263d;
  --portal-muted: #685b6c;
  --portal-paper: #fffafd;
  --portal-lilac: #f3eaf8;
  --portal-line: #dfcfe5;
  --portal-plum: #70477b;
  --portal-rose: #b74e75;
  --portal-gold: #d3a33e;
  --portal-mint: #5f8c80;
  --portal-night: #342f55;
  --portal-white: #ffffff;
}

.portal-page {
  color: var(--portal-ink);
  background: var(--portal-paper);
}

.portal-breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px clamp(20px, 7vw, 96px);
  border-bottom: 1px solid var(--portal-line);
  color: var(--portal-muted);
  background: var(--portal-paper);
  font-size: 0.82rem;
}

.portal-breadcrumb a {
  color: var(--portal-plum);
  font-weight: 800;
}

.work-credit {
  width: fit-content;
  margin-top: 16px;
  padding: 5px 10px;
  border-left: 3px solid var(--portal-gold);
  color: var(--portal-night);
  background: #fffaf0;
  font-weight: 900;
}

.legacy-portal-guide {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  padding: 22px clamp(20px, 7vw, 96px);
  border-bottom: 1px solid #d8b65e;
  color: var(--portal-night);
  background: #fff7d9;
}

.legacy-portal-guide p {
  margin: 5px 0 0;
}

.legacy-portal-guide .portal-button {
  flex: 0 0 auto;
}

.portal-page .site-header {
  border-bottom-color: var(--portal-line);
  background: rgba(255, 250, 253, 0.96);
}

.portal-page .brand {
  gap: 11px;
}

.portal-page .brand-mark {
  border-color: rgba(112, 71, 123, 0.24);
  background: var(--portal-lilac);
}

.portal-page .brand-mark img {
  object-fit: contain;
}

.portal-brand-copy {
  display: grid;
  gap: 1px;
  line-height: 1.2;
}

.portal-brand-copy small {
  color: var(--portal-muted);
  font-size: 0.66rem;
  font-weight: 700;
}

.portal-page .nav a:hover,
.portal-page .nav a:focus-visible {
  color: var(--portal-rose);
}

.portal-desktop-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: clamp(12px, 2.4vw, 26px);
  margin-left: auto;
  color: var(--portal-muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.portal-desktop-nav a:hover,
.portal-desktop-nav a:focus-visible {
  color: var(--portal-rose);
}

.portal-page .nav-menu {
  display: none;
}

.portal-preview-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 38px;
  padding: 7px 18px;
  color: var(--portal-white);
  background: var(--portal-night);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.portal-preview-notice strong {
  color: #f5d47f;
}

.portal-preview-short,
.portal-lead-short {
  display: none;
}

.portal-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
  gap: clamp(24px, 4vw, 54px);
  align-items: center;
  min-height: min(510px, 50svh);
  padding: clamp(26px, 4vw, 46px) clamp(20px, 7vw, 96px) 18px;
  overflow: hidden;
  border-bottom: 1px solid var(--portal-line);
  background: var(--portal-lilac);
}

.portal-hero-copy {
  position: relative;
  z-index: 2;
  max-width: 760px;
}

.portal-kicker,
.portal-section-kicker {
  margin: 0 0 10px;
  color: var(--portal-rose);
  font-size: 0.78rem;
  font-weight: 900;
}

.portal-hero h1 {
  max-width: 800px;
  color: var(--portal-night);
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.04;
}

.portal-tagline {
  margin: 20px 0 0;
  padding-left: 14px;
  border-left: 5px solid var(--portal-gold);
  color: var(--portal-plum);
  font-size: clamp(1.08rem, 2vw, 1.42rem);
  font-weight: 900;
}

.portal-lead {
  max-width: 680px;
  margin: 20px 0 0;
  color: var(--portal-muted);
  font-size: clamp(0.98rem, 1.7vw, 1.08rem);
}

.portal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  margin-top: 26px;
}

.portal-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--portal-plum);
  border-radius: 7px;
  font-weight: 900;
  line-height: 1.35;
  transition:
    transform 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.portal-button:hover,
.portal-button:focus-visible {
  transform: translateY(-2px);
}

.portal-button.primary {
  color: var(--portal-white);
  background: var(--portal-plum);
}

.portal-button.secondary {
  color: var(--portal-plum);
  background: var(--portal-white);
}

.portal-court {
  position: relative;
  width: min(100%, 680px);
  min-height: clamp(300px, 38vw, 440px);
  margin-inline: auto;
}

.portal-court a {
  position: absolute;
  bottom: 0;
  display: block;
  width: auto;
  aspect-ratio: 1;
  transition: transform 180ms ease;
}

.portal-court a:hover,
.portal-court a:focus-visible {
  z-index: 5;
  transform: translateY(-8px);
}

.portal-court img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 14px 18px rgba(52, 47, 85, 0.14));
}

.portal-court .court-kohatan {
  left: -2%;
  z-index: 3;
  height: 70%;
}

.portal-court .court-nekohime {
  left: 50%;
  z-index: 2;
  height: 82%;
  translate: -50% 0;
}

.portal-court .court-shiromimi {
  right: -2%;
  z-index: 3;
  height: 72%;
}

.portal-court-label {
  position: absolute;
  right: 8%;
  bottom: 12px;
  z-index: 4;
  max-width: 230px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--portal-line);
  border-radius: 7px;
  color: var(--portal-muted);
  background: rgba(255, 255, 255, 0.9);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
}

.portal-intro-band {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  gap: clamp(28px, 6vw, 76px);
  align-items: center;
  padding: clamp(46px, 7vw, 82px) clamp(20px, 7vw, 96px);
  border-bottom: 1px solid var(--portal-line);
  background: var(--portal-white);
}

.portal-intro-band h2,
.portal-section-heading h2 {
  color: var(--portal-night);
}

.portal-intro-band p:not(.portal-section-kicker) {
  margin: 0;
  color: var(--portal-muted);
  font-size: 1.04rem;
}

.portal-intro-band .portal-intro-tagline {
  margin-bottom: 10px;
  color: var(--portal-plum);
  font-weight: 800;
}

.portal-intro-band .portal-button {
  margin-top: 20px;
}

.portal-section {
  padding: clamp(52px, 7vw, 88px) clamp(20px, 7vw, 96px);
}

.portal-section-heading {
  max-width: 820px;
  margin-bottom: 28px;
}

.portal-section-heading > p:last-child {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--portal-muted);
}

.portal-gate-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--portal-line);
  border-left: 1px solid var(--portal-line);
}

.portal-gate {
  position: relative;
  display: flex;
  min-height: 270px;
  flex-direction: column;
  padding: 24px;
  border-right: 1px solid var(--portal-line);
  border-bottom: 1px solid var(--portal-line);
  background: var(--portal-white);
  transition:
    background 160ms ease,
    transform 160ms ease;
}

a.portal-gate:hover,
a.portal-gate:focus-visible {
  z-index: 1;
  background: #fff5fa;
  transform: translateY(-3px);
}

.portal-gate:nth-child(4n + 2) {
  border-top: 4px solid var(--portal-gold);
}

.portal-gate:nth-child(4n + 3) {
  border-top: 4px solid var(--portal-mint);
}

.portal-gate:nth-child(4n + 4) {
  border-top: 4px solid var(--portal-rose);
}

.portal-gate:nth-child(4n + 1) {
  border-top: 4px solid var(--portal-plum);
}

.portal-gate-status {
  width: fit-content;
  margin: 0 0 18px;
  padding: 3px 8px;
  border: 1px solid var(--portal-line);
  border-radius: 999px;
  color: var(--portal-plum);
  background: var(--portal-lilac);
  font-size: 0.7rem;
  font-weight: 900;
}

.portal-gate h3 {
  color: var(--portal-night);
  font-size: 1.17rem;
}

.portal-gate p {
  margin: 9px 0 18px;
  color: var(--portal-muted);
  font-size: 0.92rem;
}

.portal-gate-link {
  margin-top: auto;
  color: var(--portal-rose);
  font-weight: 900;
}

.portal-gate-preparing {
  background: #faf7fb;
}

.portal-life-band {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: clamp(28px, 6vw, 72px);
  align-items: center;
  padding: clamp(48px, 7vw, 82px) clamp(20px, 7vw, 96px);
  border-block: 1px solid var(--portal-line);
  background: #f3f8f5;
}

.portal-life-band h2 {
  color: #315e54;
}

.portal-life-band p {
  color: #536a64;
}

.portal-life-quote {
  margin: 0;
  padding: 24px;
  border-left: 5px solid var(--portal-mint);
  background: var(--portal-white);
  font-size: clamp(1.03rem, 2vw, 1.25rem);
  font-weight: 800;
}

.portal-news-list {
  display: grid;
  border-top: 1px solid var(--portal-line);
}

.portal-news-item {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--portal-line);
}

.portal-news-item time {
  color: var(--portal-plum);
  font-size: 0.86rem;
  font-weight: 900;
}

.portal-news-item p {
  margin: 0;
}

.portal-welcome {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  max-width: 960px;
  margin: 0 auto clamp(56px, 8vw, 94px);
  padding: 26px;
  border-block: 1px solid var(--portal-line);
}

.portal-welcome-avatar {
  position: relative;
  width: 104px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 3px solid var(--portal-white);
  border-radius: 50%;
  outline: 2px solid rgba(183, 78, 117, 0.4);
  background: var(--portal-lilac);
}

.portal-welcome-avatar img {
  position: absolute;
  top: -13%;
  left: 50%;
  width: 238%;
  max-width: none;
  transform: translateX(-50%);
}

.portal-welcome-copy {
  position: relative;
}

.portal-welcome-name {
  width: fit-content;
  margin: 0 0 7px;
  padding: 3px 10px;
  border: 1px solid rgba(183, 78, 117, 0.36);
  border-radius: 999px;
  color: var(--portal-plum);
  background: #fff2f7;
  font-size: 0.77rem;
  font-weight: 900;
}

.portal-welcome-copy p:last-child {
  margin: 0;
  color: var(--portal-night);
  font-size: clamp(1.02rem, 2vw, 1.28rem);
  font-weight: 900;
}

.portal-footer {
  padding: 36px clamp(20px, 7vw, 96px);
  color: #f8f2fa;
  background: var(--portal-night);
}

.portal-footer-main {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
  gap: 34px;
  padding-bottom: 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.portal-footer-title {
  margin: 0;
  color: var(--portal-white);
  font-size: 1.12rem;
  font-weight: 900;
}

.portal-footer-tagline {
  margin: 8px 0 0;
  color: #d9cddd;
  font-size: 0.88rem;
}

.portal-footer-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 22px;
}

.portal-footer-nav a {
  color: #f8f2fa;
  font-size: 0.88rem;
  font-weight: 700;
}

.portal-footer-nav a:hover,
.portal-footer-nav a:focus-visible {
  color: #f5d47f;
}

.portal-footer small {
  display: block;
  margin-top: 20px;
  color: #c7bbc9;
}

.empire-guide-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(260px, 0.82fr);
  gap: clamp(28px, 6vw, 72px);
  align-items: end;
  min-height: 520px;
  padding: clamp(52px, 8vw, 96px) clamp(20px, 7vw, 96px) 0;
  overflow: hidden;
  border-bottom: 1px solid var(--portal-line);
  background: var(--portal-lilac);
}

.empire-guide-hero h1 {
  max-width: 820px;
  color: var(--portal-night);
  font-size: clamp(2.45rem, 6vw, 5.2rem);
}

.empire-guide-hero .portal-tagline {
  margin-bottom: 54px;
}

.empire-guide-hero img {
  width: min(100%, 430px);
  max-height: 500px;
  margin-inline: auto;
  object-fit: contain;
  object-position: center bottom;
}

.empire-guide-layout {
  display: grid;
  grid-template-columns: minmax(180px, 0.3fr) minmax(0, 1fr);
  gap: clamp(34px, 6vw, 84px);
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(50px, 7vw, 88px) clamp(20px, 5vw, 64px);
}

.empire-guide-nav {
  position: sticky;
  top: 90px;
  align-self: start;
  padding-left: 16px;
  border-left: 3px solid var(--portal-gold);
}

.empire-guide-nav strong {
  display: block;
  margin-bottom: 12px;
  color: var(--portal-night);
}

.empire-guide-nav a {
  display: block;
  padding: 6px 0;
  color: var(--portal-muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.empire-guide-nav a:hover,
.empire-guide-nav a:focus-visible {
  color: var(--portal-rose);
}

.empire-guide-article {
  min-width: 0;
}

.empire-guide-lead {
  margin: 0 0 50px;
  padding-bottom: 34px;
  border-bottom: 1px solid var(--portal-line);
  color: var(--portal-night);
  font-size: clamp(1.04rem, 2vw, 1.22rem);
  font-weight: 700;
}

.empire-guide-section {
  scroll-margin-top: 100px;
  margin-bottom: clamp(58px, 8vw, 92px);
}

.empire-guide-section h2 {
  margin-bottom: 22px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--portal-line);
  color: var(--portal-night);
  font-size: clamp(1.65rem, 3.7vw, 2.6rem);
}

.empire-guide-section h3 {
  margin-top: 32px;
  color: var(--portal-plum);
}

.empire-guide-section p {
  color: var(--portal-muted);
}

.empire-guide-section strong {
  color: var(--portal-ink);
}

.empire-character-quote {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin: 28px 0;
  padding: 20px;
  border: 1px solid var(--portal-line);
  border-left: 5px solid var(--portal-rose);
  border-radius: 7px;
  background: var(--portal-white);
}

.empire-character-quote figure {
  display: grid;
  justify-items: center;
  margin: 0;
}

.empire-character-quote .portal-welcome-avatar {
  width: 78px;
}

.empire-character-quote figcaption {
  position: relative;
  z-index: 1;
  margin-top: -5px;
  padding: 3px 9px;
  border: 1px solid rgba(183, 78, 117, 0.36);
  border-radius: 999px;
  color: var(--portal-plum);
  background: #fff2f7;
  font-size: 0.7rem;
  font-weight: 900;
  white-space: nowrap;
}

.empire-character-quote blockquote {
  margin: 0;
  color: var(--portal-night);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  font-weight: 900;
}

.imperial-edict {
  margin: 30px 0;
  padding: 22px 24px;
  border-block: 1px solid var(--portal-gold);
  color: var(--portal-night);
  background: #fffaf0;
  font-size: 1.08rem;
  font-weight: 900;
  text-align: center;
}

.empire-name-note {
  margin: 26px 0;
  padding: 18px 20px;
  border-left: 4px solid var(--portal-mint);
  background: #f1f8f5;
}

.empire-name-note p {
  margin: 4px 0;
}

.empire-entry-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.empire-entry-list a {
  display: block;
  padding: 18px;
  border: 1px solid var(--portal-line);
  border-radius: 7px;
  background: var(--portal-white);
}

.empire-entry-list strong {
  display: block;
  color: var(--portal-night);
}

.empire-entry-list span {
  display: block;
  margin-top: 4px;
  color: var(--portal-muted);
  font-size: 0.87rem;
}

.empire-entry-list a:hover,
.empire-entry-list a:focus-visible {
  border-color: var(--portal-rose);
}

@media (max-width: 1040px) {
  .portal-gate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-gate {
    min-height: 240px;
  }
}

@media (max-width: 800px) {
  .portal-hero,
  .portal-intro-band,
  .portal-life-band,
  .empire-guide-hero {
    grid-template-columns: 1fr;
  }

  .portal-hero {
    min-height: 0;
    padding-top: 42px;
  }

  .portal-court {
    min-height: clamp(340px, 96vw, 520px);
  }

  .portal-intro-band {
    gap: 18px;
  }

  .portal-life-band {
    gap: 20px;
  }

  .empire-guide-hero {
    min-height: 0;
  }

  .empire-guide-hero .portal-tagline {
    margin-bottom: 0;
  }

  .empire-guide-hero img {
    max-height: 410px;
  }

  .empire-guide-layout {
    grid-template-columns: 1fr;
  }

  .empire-guide-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    padding: 14px 0;
    border-left: 0;
    border-block: 1px solid var(--portal-line);
  }

  .empire-guide-nav strong {
    width: 100%;
    margin-bottom: 3px;
  }
}

@media (max-width: 720px) {
  .portal-page .site-header {
    align-items: center;
  }

  .portal-page .brand {
    max-width: calc(100% - 92px);
  }

  .portal-brand-copy > span {
    font-size: 0.86rem;
  }

  .portal-brand-copy small {
    display: none;
  }

  .portal-desktop-nav {
    display: none;
  }

  .portal-page .nav-menu {
    display: block;
    position: static;
  }

  .portal-page .nav-menu summary {
    display: block;
  }

  .portal-page .nav-menu:not([open]) > .nav {
    display: none;
  }

  .portal-page .nav-menu[open] > .nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    display: grid;
    gap: 0;
    width: 100%;
    max-height: calc(100svh - 100%);
    overflow-y: auto;
    padding: 7px 14px 15px;
    border-bottom: 1px solid var(--portal-line);
    background: var(--portal-paper);
  }

  .portal-page .nav a {
    padding: 10px 0;
    border-bottom: 1px solid var(--portal-line);
  }

  .portal-footer-main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 580px) {
  .legacy-portal-guide {
    display: grid;
    gap: 14px;
  }

  .legacy-portal-guide .portal-button {
    width: 100%;
  }
  .portal-preview-notice {
    min-height: 36px;
    padding: 6px 14px;
    font-size: 0.72rem;
  }

  .portal-preview-long,
  .portal-lead-long {
    display: none;
  }

  .portal-preview-short,
  .portal-lead-short {
    display: inline;
  }

  .portal-hero {
    gap: 8px;
    padding: 24px 20px 10px;
  }

  .portal-hero h1 {
    font-size: 2.45rem;
  }

  .portal-kicker {
    margin-bottom: 6px;
    font-size: 0.72rem;
  }

  .portal-tagline {
    margin-top: 12px;
    padding-left: 11px;
    font-size: 1.04rem;
  }

  .portal-lead {
    margin-top: 12px;
    font-size: 0.88rem;
    line-height: 1.72;
  }

  .portal-actions {
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 16px;
  }

  .portal-button {
    min-height: 42px;
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  .portal-court {
    width: calc(100% + 20px);
    min-height: 205px;
    margin-left: -10px;
  }

  .portal-court-label {
    right: 2%;
    font-size: 0.69rem;
  }

  .portal-gate-grid,
  .empire-entry-list {
    grid-template-columns: 1fr;
  }

  .portal-gate {
    min-height: 210px;
  }

  .portal-news-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .portal-welcome {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 15px;
    padding-inline: 18px;
  }

  .portal-welcome-avatar {
    width: 78px;
  }

  .portal-footer-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .empire-character-quote {
    grid-template-columns: 74px minmax(0, 1fr);
    padding: 16px 13px;
  }

  .empire-character-quote .portal-welcome-avatar {
    width: 66px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-button,
  .portal-court a,
  .portal-gate {
    transition: none;
  }
}
