:root {
  --portal-ink: #102a43;
  --portal-ink-soft: #39566b;
  --portal-blue: #245b7a;
  --portal-blue-dark: #173f5a;
  --portal-paper: #f8f7f2;
  --portal-card: #fffefa;
  --portal-line: #d9e0df;
  --portal-muted: #687c88;
  --portal-orange: #c96d3c;
  --portal-orange-dark: #984b2a;
  --portal-gold: #e4a34f;
  --portal-sage: #dce9e1;
  --portal-shadow: 0 18px 50px rgba(16, 42, 67, .10);
  --portal-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 82px; }
body { margin: 0; min-width: 320px; color: var(--portal-ink); background: var(--portal-paper); font: 16px/1.6 var(--portal-font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
:focus-visible { outline: 3px solid var(--portal-gold); outline-offset: 3px; }
.portal-wrap { width: min(1160px, calc(100% - 48px)); margin: 0 auto; }
.portal-skip { position: fixed; z-index: 99; top: -60px; left: 18px; padding: 9px 14px; border-radius: 8px; color: #162d40; background: var(--portal-gold); font-size: 14px; font-weight: 700; transition: top .18s ease; }
.portal-skip:focus { top: 14px; }

.portal-header { position: sticky; z-index: 20; top: 0; color: #fff; background: rgba(16, 42, 67, .97); border-bottom: 1px solid rgba(255,255,255,.12); }
.portal-header__inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.portal-brand { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
.portal-brand__mark { width: 42px; height: 42px; display: grid; place-items: center; flex: none; border-radius: 13px; background: #fff; }
.portal-brand__mark img { width: 33px; height: 33px; object-fit: contain; }
.portal-brand__name { display: grid; line-height: 1.15; }
.portal-brand__name strong { font-size: 16px; letter-spacing: .07em; white-space: nowrap; }
.portal-brand__name small { margin-top: 5px; color: #b9c9d4; font: 10px/1.2 "SFMono-Regular", Consolas, monospace; letter-spacing: .12em; }
.portal-header__nav { display: flex; align-items: center; gap: 8px; }
.portal-header__nav a, .portal-header__nav button { min-height: 44px; display: inline-flex; align-items: center; padding: 0 12px; border: 0; border-radius: 9px; color: #dce7ed; background: transparent; font-size: 14px; }
.portal-header__nav a:hover, .portal-header__nav button:hover { color: #fff; background: rgba(255,255,255,.10); }
.portal-header__nav .portal-header__cta { padding: 0 16px; color: var(--portal-ink); background: var(--portal-gold); font-weight: 700; }
.portal-header__nav .portal-header__cta:hover { color: var(--portal-ink); background: #f0bd70; }

.portal-hero { position: relative; overflow: hidden; color: #fff; background: var(--portal-ink); }
.portal-hero::before, .portal-hero::after { position: absolute; content: ""; border: 1px solid rgba(224, 239, 236, .14); border-radius: 50%; pointer-events: none; }
.portal-hero::before { width: 640px; height: 640px; right: -210px; top: -335px; }
.portal-hero::after { width: 420px; height: 420px; right: -75px; top: -225px; }
.portal-hero__grid { position: relative; z-index: 1; min-height: 555px; display: grid; grid-template-columns: minmax(0, .9fr) minmax(360px, .8fr); align-items: center; gap: clamp(40px, 7vw, 100px); padding: 70px 0 78px; }
.portal-eyebrow { margin: 0 0 18px; color: var(--portal-orange); font: 11px/1.4 "SFMono-Regular", Consolas, monospace; letter-spacing: .12em; }
.portal-eyebrow--light { color: #e9b467; }
.portal-hero h1 { max-width: 620px; margin: 0; font-size: clamp(43px, 6vw, 76px); line-height: 1.12; letter-spacing: -.07em; }
.portal-hero h1 em { color: #f0bc70; font-style: normal; }
.portal-hero__lead { max-width: 500px; margin: 25px 0 0; color: #c9d6dc; font-size: 17px; line-height: 1.8; }
.portal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.portal-button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 18px; border: 1px solid transparent; border-radius: 10px; font-size: 14px; font-weight: 700; transition: transform .14s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease; }
.portal-button:active { transform: translateY(1px); }
.portal-button--primary { color: var(--portal-ink); background: var(--portal-gold); box-shadow: 0 10px 24px rgba(228,163,79,.18); }
.portal-button--primary:hover { background: #f0bd70; box-shadow: 0 13px 28px rgba(228,163,79,.24); }
.portal-button--dark { color: #fff; border-color: rgba(255,255,255,.28); background: transparent; }
.portal-button--dark:hover { border-color: rgba(255,255,255,.58); background: rgba(255,255,255,.10); }
.portal-hero__note { display: flex; align-items: center; gap: 8px; max-width: 420px; margin-top: 25px; color: #a6bac5; font-size: 13px; }
.portal-hero__note svg { color: #e9b467; flex: none; }

.portal-visual { position: relative; min-height: 400px; display: grid; place-items: center; perspective: 900px; }
.portal-visual__frame { width: min(100%, 470px); aspect-ratio: 1 / 1; position: relative; overflow: hidden; isolation: isolate; border: 1px solid rgba(219,239,232,.34); border-radius: 30px; background: #0b1d38; box-shadow: 0 28px 70px rgba(0,0,0,.30), 0 0 45px rgba(85,164,184,.10), inset 0 1px 0 rgba(255,255,255,.16); }
.portal-visual__frame::before { position: absolute; inset: 10px; z-index: 2; content: ""; border: 1px solid rgba(255,255,255,.10); border-radius: 23px; pointer-events: none; }
.portal-visual__frame::after { position: absolute; inset: 0; z-index: 1; content: ""; background: linear-gradient(125deg, rgba(255,255,255,.13), transparent 17%, transparent 72%, rgba(255,181,111,.13)); mix-blend-mode: screen; pointer-events: none; }
.portal-visual__image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.015); animation: portal-image-float 12s ease-in-out infinite; }
.portal-visual__shine { position: absolute; z-index: 3; top: -20%; left: -40%; width: 32%; height: 150%; content: ""; transform: rotate(19deg); background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent); filter: blur(14px); animation: portal-shine 9s ease-in-out infinite; pointer-events: none; }
.portal-visual__caption { display: inline-flex; align-items: center; gap: 9px; margin-top: 16px; color: #9fb8c3; font: 10px/1.3 "SFMono-Regular", Consolas, monospace; letter-spacing: .18em; }
.portal-visual__caption::before { width: 28px; height: 1px; content: ""; background: var(--portal-gold); }
@keyframes portal-image-float { 0%, 100% { transform: scale(1.015) translate3d(0, 0, 0); } 50% { transform: scale(1.045) translate3d(-.4%, -.5%, 0); } }
@keyframes portal-shine { 0%, 55% { opacity: 0; transform: translateX(-60%) rotate(19deg); } 70% { opacity: .7; } 100% { opacity: 0; transform: translateX(480%) rotate(19deg); } }

.portal-roles { padding: 92px 0 104px; }
.portal-section-head { display: grid; grid-template-columns: minmax(0, .75fr) minmax(0, .9fr); align-items: end; gap: 60px; }
.portal-section-head h2, .portal-guide h2 { max-width: 500px; margin: 0; font-size: clamp(36px, 5vw, 58px); line-height: 1.12; letter-spacing: -.065em; }
.portal-section-head > p { max-width: 430px; margin: 0; color: var(--portal-muted); font-size: 15px; line-height: 1.85; }
.portal-role-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 52px; }
.portal-role-card { min-height: 278px; display: flex; flex-direction: column; padding: 21px; border: 1px solid transparent; border-radius: 18px; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.portal-role-card:hover { transform: translateY(-4px); box-shadow: var(--portal-shadow); }
.portal-role-card--student { background: #f1ddd4; }
.portal-role-card--teacher { background: #dce8ef; }
.portal-role-card--academic { background: #e5e8d9; }
.portal-role-card--admin { background: #eee1c9; }
.portal-role-card__top { display: flex; align-items: center; justify-content: space-between; color: rgba(16,42,67,.55); font: 11px "SFMono-Regular", Consolas, monospace; letter-spacing: .08em; }
.portal-last-used { padding: 3px 7px; border-radius: 999px; color: var(--portal-orange-dark); background: rgba(255,255,255,.6); font: 10px var(--portal-font); letter-spacing: 0; }
.portal-role-card__icon { width: 50px; height: 50px; display: grid; place-items: center; margin-top: 31px; border-radius: 15px; color: var(--portal-ink); background: rgba(255,255,255,.48); }
.portal-role-card__icon svg { width: 25px; height: 25px; }
.portal-role-card h3 { margin: 18px 0 4px; font-size: 21px; letter-spacing: -.04em; }
.portal-role-card p { margin: 0; color: rgba(16,42,67,.75); font-size: 13px; line-height: 1.65; }
.portal-role-card__button { align-self: flex-start; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; margin-top: auto; padding: 0; border: 0; color: var(--portal-blue-dark); background: transparent; font-size: 13px; font-weight: 800; }
.portal-role-card__button:hover { color: var(--portal-orange-dark); }

.portal-guide { padding: 80px 0; color: #fff; background: var(--portal-blue-dark); }
.portal-guide__grid { display: grid; grid-template-columns: .75fr 1fr .65fr; gap: 52px; align-items: start; }
.portal-guide h2 { color: #fff; }
.portal-steps { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.portal-steps li { display: grid; grid-template-columns: 40px 1fr; gap: 16px; padding: 0 0 18px; border-bottom: 1px solid rgba(255,255,255,.16); }
.portal-steps li + li { padding-top: 18px; }
.portal-steps b { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--portal-ink); background: var(--portal-gold); font: 11px "SFMono-Regular", Consolas, monospace; }
.portal-steps li:nth-child(2) b { background: #efb18f; }
.portal-steps li:nth-child(3) b { background: #bcd8c7; }
.portal-steps strong, .portal-steps span { display: block; }
.portal-steps strong { color: #fff; font-size: 15px; }
.portal-steps span { margin-top: 2px; color: #c7d6db; font-size: 13px; }
.portal-guide__link { align-self: end; padding: 16px 0 8px; border-bottom: 1px solid var(--portal-gold); color: #dce7e8; font-size: 13px; }
.portal-guide__link strong { display: block; margin-top: 5px; color: var(--portal-gold); }
.portal-footer { color: #b2c2c9; background: var(--portal-ink); }
.portal-footer__inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 12px; }
.portal-footer a:hover, .portal-footer button:hover { color: #fff; }
.portal-footer button { min-height: 44px; padding: 0; border: 0; color: inherit; background: transparent; }

.portal-subpage { min-height: 100dvh; display: flex; flex-direction: column; }
.portal-subpage main { flex: 1; padding: 72px 0 90px; }
.identity-intro, .test-intro { max-width: 670px; }
.identity-intro h1, .test-intro h1 { margin: 0; font-size: clamp(38px, 5vw, 62px); line-height: 1.12; letter-spacing: -.07em; }
.identity-intro p, .test-intro p { max-width: 560px; margin: 18px 0 0; color: var(--portal-muted); font-size: 16px; }
.identity-role-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 45px; }
.identity-role { min-height: 178px; display: flex; flex-direction: column; align-items: flex-start; padding: 19px; border: 1px solid var(--portal-line); border-radius: 16px; color: var(--portal-ink); background: var(--portal-card); text-align: left; box-shadow: 0 5px 18px rgba(16,42,67,.04); transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.identity-role:hover { transform: translateY(-3px); border-color: var(--portal-blue); box-shadow: var(--portal-shadow); }
.identity-role[aria-pressed="true"] { border-color: var(--portal-blue); box-shadow: 0 0 0 3px rgba(36,91,122,.13); }
.identity-role__icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 13px; color: var(--portal-blue); background: #e8f0f2; }
.identity-role h2 { margin: 15px 0 2px; font-size: 18px; }
.identity-role span { color: var(--portal-muted); font-size: 13px; line-height: 1.55; }
.identity-continue { display: flex; align-items: center; flex-wrap: wrap; gap: 17px; margin-top: 28px; }
.identity-current { color: var(--portal-muted); font-size: 14px; }
.identity-current strong { color: var(--portal-ink); }
.identity-continue .portal-button[aria-disabled="true"] { opacity: .52; cursor: not-allowed; }

.test-page main { padding-bottom: 100px; }
.test-badge { display: inline-flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 10px; border-radius: 999px; color: #7d411f; background: #f6dfc5; font-size: 13px; font-weight: 800; }
.test-badge::before { width: 7px; height: 7px; content: ""; border-radius: 50%; background: var(--portal-orange); }
.test-card { max-width: 860px; margin-top: 37px; padding: 26px; border: 1px solid var(--portal-line); border-radius: 20px; background: var(--portal-card); box-shadow: var(--portal-shadow); }
.test-card h2 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.test-role-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 19px; }
.test-role { min-height: 92px; display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--portal-line); border-radius: 13px; color: var(--portal-ink); background: #fff; text-align: left; transition: border-color .18s ease, background .18s ease, transform .14s ease; }
.test-role:hover { border-color: var(--portal-blue); background: #f2f7f7; transform: translateY(-2px); }
.test-role__icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: var(--portal-blue); background: #e8f0f2; }
.test-role strong, .test-role small { display: block; }
.test-role strong { font-size: 14px; }
.test-role small { margin-top: 1px; color: var(--portal-muted); font-size: 12px; }
.test-option { display: flex; align-items: flex-start; gap: 10px; margin-top: 27px; padding-top: 20px; border-top: 1px solid var(--portal-line); color: var(--portal-ink-soft); font-size: 14px; }
.test-option input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--portal-blue); }
.test-option small { display: block; margin-top: 3px; color: var(--portal-muted); font-size: 12px; }
.test-disabled { max-width: 620px; margin-top: 38px; padding: 26px; border: 1px solid var(--portal-line); border-radius: 18px; background: var(--portal-card); }
.test-disabled h2 { margin: 0 0 7px; font-size: 20px; }
.test-disabled p { margin: 0; color: var(--portal-muted); font-size: 14px; }

@media (max-width: 980px) {
  .portal-role-grid, .identity-role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-guide__grid { grid-template-columns: .75fr 1fr; }
  .portal-guide__link { grid-column: 2; }
}
@media (max-width: 760px) {
  html { scroll-padding-top: 70px; }
  .portal-wrap { width: min(1160px, calc(100% - 32px)); }
  .portal-header__inner { min-height: 68px; }
  .portal-header__nav a:not(.portal-header__cta), .portal-header__nav button { display: none; }
  .portal-header__nav .portal-header__cta { min-height: 44px; }
  .portal-hero__grid { grid-template-columns: 1fr; min-height: auto; padding: 52px 0 65px; }
  .portal-hero__lead { font-size: 16px; }
  .portal-visual { min-height: 350px; }
  .portal-visual__caption { margin-top: 12px; }
  .portal-section-head { grid-template-columns: 1fr; gap: 22px; }
  .portal-roles { padding: 72px 0 80px; }
  .portal-role-grid { margin-top: 37px; }
  .portal-guide__grid { grid-template-columns: 1fr; gap: 32px; }
  .portal-guide__link { grid-column: auto; }
  .portal-footer__inner { align-items: flex-start; flex-direction: column; justify-content: center; padding: 16px 0; gap: 4px; }
  .portal-subpage main { padding: 52px 0 74px; }
  .identity-role-grid { margin-top: 34px; }
  .test-role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .portal-wrap { width: calc(100% - 28px); }
  .portal-brand__mark { width: 37px; height: 37px; border-radius: 11px; }
  .portal-brand__mark img { width: 29px; height: 29px; }
  .portal-brand__name strong { font-size: 14px; }
  .portal-brand__name small { font-size: 8px; }
  .portal-header__nav .portal-header__cta { padding: 0 11px; font-size: 13px; }
  .portal-hero h1 { font-size: clamp(37px, 11.8vw, 48px); }
  .portal-hero__lead { font-size: 15px; }
  .portal-actions { gap: 8px; margin-top: 25px; }
  .portal-button { padding: 0 14px; }
  .portal-visual { min-height: 285px; }
  .portal-visual__frame { border-radius: 22px; }
  .portal-visual__caption { font-size: 9px; letter-spacing: .12em; }
  .portal-role-grid, .identity-role-grid { grid-template-columns: 1fr; }
  .portal-role-card { min-height: 242px; }
  .portal-section-head h2, .portal-guide h2, .identity-intro h1, .test-intro h1 { font-size: 36px; }
  .test-card { padding: 19px; }
  .test-role-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
