:root {
  --space-blue: #3D6FBE;
  --ice-highlight: #78AEFF;
  --deep-space: #1F416F;
  --graphite: #25292D;
  --silver: #E8EBEF;
  --white: #FFFFFF;
  --muted: #637083;
  --line: #D7DEE8;
  --danger: #B42318;
  --shadow: 0 18px 54px rgba(31, 65, 111, .10);
  --body: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  --display: "Avenir Next", "Hiragino Sans", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }
html { color: var(--graphite); background: #F6F8FB; font-family: var(--body); -webkit-font-smoothing: antialiased; }
body { min-width: 0; margin: 0; }
a { color: inherit; }
button, input { color: inherit; font: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--ice-highlight); outline-offset: 3px; }
.portal-shell { width: min(calc(100% - 48px), 1160px); margin-inline: auto; }
.portal-header { display: flex; min-height: 96px; align-items: center; justify-content: space-between; gap: 24px; }
.portal-brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.portal-brand-mark { display: grid; width: 48px; height: 48px; place-items: center; color: var(--white); background: var(--space-blue); border-radius: 14px; font: 800 1.45rem/1 var(--display); }
.portal-brand strong, .portal-brand small { display: block; }
.portal-brand strong { color: var(--deep-space); font: 800 .9rem/1 var(--display); letter-spacing: .17em; }
.portal-brand small { margin-top: 5px; color: var(--muted); font: 700 .54rem/1 var(--display); letter-spacing: .13em; }
.portal-back { color: var(--deep-space); font-size: .78rem; font-weight: 750; text-decoration: none; }
.portal-navigation { display: flex; gap: 4px; margin-left: auto; padding: 4px; background: var(--silver); border: 1px solid var(--line); border-radius: 12px; }
.portal-navigation a { min-height: 38px; padding: 8px 15px; color: var(--deep-space); border-radius: 8px; font-size: .74rem; font-weight: 800; text-decoration: none; }
.portal-navigation a:hover { background: var(--white); }
.portal-navigation a[aria-current="page"] { color: var(--white); background: var(--space-blue); box-shadow: 0 5px 14px rgba(61, 111, 190, .20); }
.portal-kicker { margin: 0 0 16px; color: var(--space-blue); font: 800 .68rem/1 var(--display); letter-spacing: .16em; }

.portal-entry { min-height: 100vh; background: linear-gradient(135deg, #F8FAFD 0 62%, #EEF3FA 62% 100%); }
.portal-entry-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, .65fr); min-height: calc(100vh - 96px); gap: clamp(32px, 6vw, 84px); align-items: center; padding-block: 52px 82px; }
.portal-entry-copy { max-width: 650px; }
.portal-entry-copy h1 { margin: 0; color: var(--deep-space); font: 750 clamp(3rem, 6vw, 5.7rem)/1.03 var(--display); letter-spacing: -.06em; }
.portal-entry-copy > p:last-child { max-width: 580px; margin: 28px 0 0; color: var(--muted); font-size: .94rem; line-height: 1.9; }
.portal-entry-panel { position: relative; overflow: hidden; min-height: 510px; display: grid; align-items: center; padding: clamp(36px, 5vw, 62px); color: var(--white); background: var(--deep-space); border-radius: 28px; box-shadow: var(--shadow); }
.portal-entry-panel::before { position: absolute; top: -110px; right: -80px; width: 260px; height: 260px; border: 1px solid rgba(120, 174, 255, .38); border-radius: 50%; content: ""; }
.portal-entry--teacher .portal-entry-panel::before { border-radius: 36px; transform: rotate(18deg); }
.portal-role { display: inline-flex; min-height: 30px; align-items: center; padding: 0 11px; color: #DCE9FF; background: rgba(120, 174, 255, .16); border: 1px solid rgba(120, 174, 255, .28); border-radius: 999px; font-size: .68rem; font-weight: 800; }
.portal-entry-panel h2 { margin: 22px 0 30px; font: 750 clamp(1.75rem, 3vw, 2.35rem)/1.2 var(--display); letter-spacing: -.03em; }
.portal-form { display: grid; gap: 19px; }
.portal-form label span { display: block; margin-bottom: 9px; color: #D8E1EF; font-size: .72rem; font-weight: 750; }
.portal-form input:not([type="hidden"]) { width: 100%; min-height: 56px; padding: 0 16px; color: var(--white); background: rgba(255, 255, 255, .07); border: 1px solid #617A9E; border-radius: 11px; }
.portal-form input:not([type="hidden"]):focus { border-color: var(--ice-highlight); }
.portal-button { min-height: 54px; margin-top: 5px; padding: 0 20px; color: var(--deep-space); background: var(--ice-highlight); border: 0; border-radius: 11px; font-size: .82rem; font-weight: 850; cursor: pointer; }
.portal-button:hover { background: #94C0FF; }
.portal-note { margin: 20px 0 0; color: #BBC9DC; font-size: .68rem; line-height: 1.7; }
.portal-error { margin: -12px 0 18px; padding: 12px 14px; color: #FFE5E2; background: rgba(180, 35, 24, .28); border: 1px solid rgba(255, 181, 174, .48); border-radius: 9px; font-size: .74rem; line-height: 1.6; }

.portal-header-actions { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: .72rem; font-weight: 750; }
.portal-header-actions form { margin: 0; }
.portal-header-actions button { padding: 7px 0; color: var(--space-blue); background: none; border: 0; font-weight: 800; cursor: pointer; }
.portal-private { padding-block: 56px 100px; }
.portal-back { display: inline-block; margin-bottom: 36px; }
.portal-page-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .5fr); gap: 56px; align-items: end; padding-bottom: 35px; border-bottom: 1px solid var(--line); }
.portal-page-head h1 { margin: 0; color: var(--deep-space); font: 750 clamp(2.6rem, 5vw, 4.7rem)/1.05 var(--display); letter-spacing: -.055em; }
.portal-page-head > p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.85; }
.portal-student-list, .portal-material-grid { margin: 34px 0 0; padding: 0; list-style: none; }
.portal-student-list { overflow: hidden; background: var(--white); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 35px rgba(31, 65, 111, .06); }
.portal-student-list li + li { border-top: 1px solid var(--line); }
.portal-student-list a { display: flex; min-height: 92px; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 26px; text-decoration: none; }
.portal-student-list a:hover { background: #F3F7FC; }
.portal-student-list strong, .portal-student-list small { display: block; }
.portal-student-list strong { color: var(--deep-space); font-size: 1.05rem; }
.portal-student-list small { margin-top: 6px; color: var(--muted); font-size: .68rem; }
.portal-student-list b { color: var(--space-blue); font-size: .73rem; }
.portal-material-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.portal-material-grid > li:not(.portal-empty) { min-width: 0; }
.portal-material-grid a { display: flex; min-height: 260px; flex-direction: column; padding: 28px; color: var(--graphite); background: var(--white); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 10px 30px rgba(31, 65, 111, .05); text-decoration: none; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.portal-material-grid a:hover { transform: translateY(-3px); border-color: var(--ice-highlight); box-shadow: var(--shadow); }
.portal-material-index { color: var(--space-blue); font: 800 .62rem/1 var(--display); letter-spacing: .14em; }
.portal-material-grid h2 { margin: 34px 0; color: var(--deep-space); font: 750 1.65rem/1.25 var(--display); letter-spacing: -.035em; overflow-wrap: anywhere; }
.portal-material-action { display: flex; justify-content: space-between; gap: 16px; margin-top: auto; padding-top: 18px; color: var(--space-blue); border-top: 1px solid var(--silver); font-size: .73rem; font-weight: 850; }
.portal-empty { padding: 30px; color: var(--muted); background: var(--white); border: 1px dashed #B9C5D6; border-radius: 15px; font-size: .82rem; line-height: 1.7; }
.portal-material-grid .portal-empty { grid-column: 1 / -1; }

@media (max-width: 820px) {
  .portal-entry-grid { grid-template-columns: 1fr; min-height: 0; padding-top: 34px; }
  .portal-entry-copy { padding-top: 26px; }
  .portal-entry-panel { min-height: 470px; }
  .portal-page-head { grid-template-columns: 1fr; gap: 20px; }
  .portal-material-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .portal-shell { width: min(calc(100% - 28px), 1160px); }
  .portal-header { min-height: 0; padding-block: 14px; flex-wrap: wrap; gap: 13px; }
  .portal-brand-mark { width: 42px; height: 42px; border-radius: 12px; }
  .portal-navigation { order: 3; width: 100%; }
  .portal-navigation a { flex: 1; min-width: 0; padding-inline: 7px; text-align: center; }
  .portal-entry-grid { gap: 36px; padding-block: 20px 44px; }
  .portal-entry-copy h1 { font-size: 2.85rem; }
  .portal-entry-copy > p:last-child { font-size: .82rem; }
  .portal-entry-panel { min-height: 430px; padding: 34px 23px; border-radius: 21px; }
  .portal-header-actions > span { display: none; }
  .portal-private { padding-block: 40px 72px; }
  .portal-page-head { padding-bottom: 26px; }
  .portal-page-head h1 { font-size: 2.55rem; }
  .portal-material-grid { grid-template-columns: 1fr; }
  .portal-student-list a { min-height: 86px; padding: 18px; }
  .portal-student-list b { max-width: 92px; text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-material-grid a { transition: none; }
  .portal-material-grid a:hover { transform: none; }
}
