:root {
    --portal-ink: #101828;
    --portal-muted: #667085;
    --portal-line: #e4e7ec;
    --portal-surface: #ffffff;
    --portal-canvas: #f5f7fb;
    --portal-blue: #3457d5;
    --portal-blue-dark: #243ca5;
    --portal-teal: #12a594;
    --portal-danger: #d92d20;
    --portal-radius: 18px;
    --portal-shadow: 0 18px 50px rgba(16, 24, 40, .09);
}

.portal-redesign,
.portal-redesign input,
.portal-redesign button {
    font-family: Pretendard, "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.portal-redesign {
    min-width: 0;
    min-height: 100vh;
    margin: 0;
    color: var(--portal-ink);
    background: var(--portal-canvas);
    -webkit-font-smoothing: antialiased;
}

.portal-redesign * { box-sizing: border-box; }
.portal-redesign a { color: inherit; }
.portal-redesign .material-symbols-outlined { line-height: 1; }

.portal-container {
    width: min(1180px, calc(100% - 48px));
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 auto;
}

.portal-eyebrow {
    display: inline-block;
    color: var(--portal-blue);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .14em;
}

.portal-brand {
    display: inline-flex;
    gap: 12px;
    align-items: center;
    color: var(--portal-ink);
    font-size: 17px;
    font-weight: 800;
    line-height: 1.1;
    text-decoration: none;
}

.portal-brand small {
    display: block;
    margin-bottom: 4px;
    color: #98a2b3;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.portal-brand__mark {
    position: relative;
    display: inline-flex;
    width: 38px;
    height: 38px;
    padding: 8px;
    gap: 3px;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    border-radius: 11px;
    background: var(--portal-blue);
    box-shadow: 0 7px 18px rgba(52, 87, 213, .25);
}

.portal-brand__mark i {
    display: block;
    width: 4px;
    height: 11px;
    border-radius: 3px;
    background: #fff;
    transform: rotate(20deg);
}

.portal-brand__mark i:nth-child(2) { height: 18px; opacity: .82; }
.portal-brand__mark i:nth-child(3) { height: 14px; opacity: .58; }
.portal-brand__logo { display: inline-flex; width: 40px; height: 40px; flex: 0 0 40px; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--portal-line); border-radius: 11px; background: #fff; }
.portal-brand__logo img { display: block; max-width: 31px; max-height: 31px; object-fit: contain; }
.portal-brand--light .portal-brand__logo { border-color: rgba(255,255,255,.20); background: rgba(255,255,255,.12); }

/* Student login */
#layout-login.portal-redesign {
    display: block;
    height: auto;
    min-height: 100vh;
    background: #fff;
}

.portal-login-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(420px, 1.05fr) minmax(460px, .95fr);
}

.portal-login-story {
    position: relative;
    display: flex;
    min-height: 100vh;
    padding: 52px clamp(48px, 7vw, 100px);
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 70% 18%, rgba(110, 231, 218, .26), transparent 27%),
        radial-gradient(circle at 14% 82%, rgba(116, 144, 255, .32), transparent 34%),
        linear-gradient(145deg, #0c1634 0%, #182d70 58%, #244eb8 100%);
}

.portal-login-story::before,
.portal-login-story::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 50%;
}

.portal-login-story::before { right: -190px; bottom: -170px; width: 570px; height: 570px; }
.portal-login-story::after { right: -95px; bottom: -75px; width: 380px; height: 380px; }
.portal-brand--light { position: relative; z-index: 1; color: #fff; }
.portal-brand--light small { color: rgba(255,255,255,.58); }
.portal-brand--light .portal-brand__mark { background: rgba(255,255,255,.16); box-shadow: none; backdrop-filter: blur(10px); }

.portal-login-story__copy { position: relative; z-index: 1; max-width: 580px; padding: 70px 0; }
.portal-login-story__copy .portal-eyebrow { color: #78e2d6; }
.portal-login-story__copy h1 { margin: 22px 0 24px; color: #fff; font-size: clamp(46px, 5vw, 74px); font-weight: 750; line-height: 1.08; letter-spacing: -.055em; }
.portal-login-story__copy p { max-width: 470px; margin: 0; color: rgba(255,255,255,.72); font-size: 18px; line-height: 1.75; }
.portal-login-story__status { position: relative; z-index: 1; display: flex; gap: 9px; align-items: center; color: rgba(255,255,255,.62); font-size: 12px; letter-spacing: .04em; }
.portal-login-story__status span { width: 7px; height: 7px; border-radius: 50%; background: #61e6c7; box-shadow: 0 0 0 5px rgba(97,230,199,.12); }

.portal-login-panel {
    display: flex;
    min-height: 100vh;
    padding: 50px clamp(34px, 7vw, 104px) 34px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
}

#layout-login #login.portal-login-card,
#layout-login .portal-login-card {
    width: min(100%, 430px);
    padding: 0;
    border-radius: 0;
    background: transparent;
}

.portal-login-card__head { margin-bottom: 36px; }
.portal-login-card__head h2 { margin: 10px 0 10px; color: var(--portal-ink); font-size: 36px; font-weight: 760; letter-spacing: -.04em; }
.portal-login-card__head p { margin: 0; color: var(--portal-muted); font-size: 15px; }

.portal-alert {
    display: flex;
    margin: 0 0 18px;
    padding: 13px 14px;
    gap: 9px;
    align-items: center;
    border: 1px solid #fecdca;
    border-radius: 10px;
    color: #b42318;
    background: #fef3f2;
    font-size: 13px;
}

.portal-alert .material-symbols-outlined { font-size: 19px; }
.portal-field { margin-bottom: 20px; }
.portal-field label { display: block; margin-bottom: 8px; color: #344054; font-size: 13px; font-weight: 700; }

.portal-input-wrap { position: relative; }
.portal-input-wrap > .material-symbols-outlined { position: absolute; top: 50%; left: 16px; color: #98a2b3; font-size: 20px; transform: translateY(-50%); pointer-events: none; }
#layout-login .portal-input-wrap input {
    width: 100%;
    height: 54px;
    padding: 0 16px 0 48px;
    border: 1px solid #d0d5dd !important;
    border-radius: 11px;
    outline: 0;
    color: var(--portal-ink);
    background: #fff;
    font-size: 15px;
    transition: border-color .2s, box-shadow .2s;
}

#layout-login .portal-input-wrap input:focus { border-color: var(--portal-blue) !important; box-shadow: 0 0 0 4px rgba(52,87,213,.11); }
#layout-login .portal-input-wrap input::placeholder { color: #b0b7c3; }

.portal-login-button {
    display: flex;
    width: 100%;
    height: 55px;
    margin-top: 8px;
    padding: 0 19px;
    border: 0;
    border-radius: 11px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    background: var(--portal-blue);
    box-shadow: 0 10px 22px rgba(52,87,213,.2);
    font-size: 15px;
    font-weight: 750;
    cursor: pointer;
    transition: background .2s, transform .2s;
}

.portal-login-button:hover { background: var(--portal-blue-dark); transform: translateY(-1px); }
.portal-login-button .material-symbols-outlined { font-size: 18px; }
.portal-login-help { display: flex; margin: 19px 0 0; gap: 7px; align-items: center; justify-content: center; color: #98a2b3; font-size: 13px; }
.portal-login-help .material-symbols-outlined { font-size: 16px; }
.portal-login-copyright { margin: 64px 0 0; color: #98a2b3; font-size: 12px; }

/* Student portal */
#layout-user.portal-redesign { display: flex; min-height: 100vh; flex-direction: column; }
#layout-user .portal-header { height: auto; padding: 0; border-bottom: 1px solid var(--portal-line); background: rgba(255,255,255,.95); text-align: left; backdrop-filter: blur(14px); }
.portal-header { position: sticky; top: 0; z-index: 30; }
.portal-header__inner { display: flex; min-height: 76px; align-items: center; justify-content: space-between; }
.portal-account { display: flex; gap: 11px; align-items: center; }
.portal-account__avatar { display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 50%; color: var(--portal-blue); background: #eef1ff; font-size: 14px; font-weight: 800; }
.portal-account__name { display: flex; padding-right: 16px; flex-direction: column; line-height: 1.2; border-right: 1px solid var(--portal-line); }
.portal-account__name small { margin-bottom: 3px; color: #98a2b3; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.portal-account__name strong { color: #344054; font-size: 14px; }
.portal-logout { display: inline-flex; padding: 9px 11px; gap: 7px; align-items: center; border-radius: 9px; color: #667085; font-size: 14px; font-weight: 700; text-decoration: none; transition: color .2s, background .2s; }
.portal-logout:hover { color: var(--portal-blue); background: #eef1ff; }
.portal-logout .material-symbols-outlined { font-size: 18px; }

.portal-main { flex: 1; padding: 54px 0 80px; }
.portal-welcome { position: relative; display: flex; min-height: 228px; padding: 44px 48px; align-items: center; justify-content: space-between; overflow: hidden; border-radius: 24px; color: #fff; background: linear-gradient(125deg, #111b3f 0%, #233c91 63%, #3763d8 100%); box-shadow: 0 20px 44px rgba(31,53,123,.18); }
.portal-welcome::after { content: ""; position: absolute; right: -60px; top: -115px; width: 330px; height: 330px; border: 62px solid rgba(255,255,255,.06); border-radius: 50%; }
.portal-welcome > div { position: relative; z-index: 1; }
.portal-welcome .portal-eyebrow { color: #72e1d4; }
.portal-welcome h1 { margin: 12px 0 12px; color: #fff; font-size: clamp(28px, 3vw, 40px); font-weight: 740; letter-spacing: -.04em; }
.portal-welcome p { margin: 0; color: rgba(255,255,255,.76); font-size: 16px; }
.portal-welcome__count { display: flex; min-width: 128px; height: 128px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; flex-direction: column; align-items: center; justify-content: center; background: rgba(255,255,255,.08); backdrop-filter: blur(10px); }
.portal-welcome__count strong { color: #fff; font-size: 38px; line-height: 1; }
.portal-welcome__count span { margin-top: 8px; color: rgba(255,255,255,.72); font-size: 13px; }

.portal-section-head { display: flex; margin: 46px 0 20px; align-items: flex-end; justify-content: space-between; }
.portal-section-head > div { display: flex; gap: 10px; align-items: center; }
.portal-section-head__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--portal-blue); box-shadow: 0 0 0 5px rgba(52,87,213,.10); }
.portal-section-head h2 { margin: 0; color: var(--portal-ink); font-size: 22px; font-weight: 750; letter-spacing: -.025em; }
.portal-section-head p { margin: 0; color: #98a2b3; font-size: 14px; }

#layout-user .portal-test-list { display: grid; margin: 0; padding: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: stretch; list-style: none; }
#layout-user .portal-test-list > li { width: auto; padding: 0; }
#layout-user .portal-test-list > li > a { position: relative; top: 0; display: flex; min-height: 270px; padding: 24px; border: 1px solid var(--portal-line); border-radius: var(--portal-radius); flex-direction: column; align-items: stretch; justify-content: flex-start; overflow: hidden; color: inherit; background: var(--portal-surface); box-shadow: 0 5px 18px rgba(16,24,40,.04); text-align: left; text-decoration: none; transition: border-color .2s, box-shadow .2s, transform .2s; }
#layout-user .portal-test-list > li > a:hover { top: 0; border-color: #b9c5f7; box-shadow: var(--portal-shadow); transform: translateY(-4px); }
.portal-test-card__top { display: flex; align-items: center; justify-content: space-between; }
.portal-test-kind { display: inline-flex; padding: 6px 10px; border-radius: 7px; color: var(--portal-blue); background: #eef1ff; font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.portal-test-kind.qb { color: #067567; background: #e7f8f5; }
.portal-test-kind.test { color: #b54708; background: #fff4e8; }
.portal-test-state { display: inline-flex; gap: 7px; align-items: center; color: #667085; font-size: 13px; font-weight: 650; }
.portal-test-state i { width: 6px; height: 6px; border-radius: 50%; background: #12b76a; }
.is-progress .portal-test-state i { background: #f79009; }
.is-finished .portal-test-state i { background: #98a2b3; }
.portal-test-card__icon { display: inline-flex; width: 50px; height: 50px; margin-top: 28px; align-items: center; justify-content: center; border-radius: 14px; color: var(--portal-blue); background: linear-gradient(145deg, #f1f3ff, #e7ebff); }
.portal-test-card__icon .material-symbols-outlined { font-size: 27px; }
#layout-user .portal-test-card__title { display: block; height: auto; min-height: 54px; margin: 16px 0 20px; color: #1d2939; font-size: 19px; font-weight: 750; line-height: 1.45; letter-spacing: -.015em; }
.portal-test-card__bottom { display: flex; margin-top: auto; padding-top: 17px; align-items: center; justify-content: space-between; border-top: 1px solid #f0f1f4; }
.portal-test-card__bottom > span { display: inline-flex; gap: 5px; align-items: center; color: #98a2b3; font-size: 12px; }
.portal-test-card__bottom > span .material-symbols-outlined { font-size: 15px; }
.portal-test-card__bottom em { display: inline-flex; gap: 4px; align-items: center; color: var(--portal-blue); font-size: 13px; font-style: normal; font-weight: 800; }
.portal-test-card__bottom em .material-symbols-outlined { font-size: 15px; }
.is-finished > a { opacity: .72; }
.is-finished .portal-test-card__bottom em { color: #667085; }
.portal-empty { display: flex !important; min-height: 260px; grid-column: 1 / -1; flex-direction: column; align-items: center; justify-content: center; border: 1px dashed #d0d5dd; border-radius: var(--portal-radius); color: #98a2b3; background: #fff; }
.portal-empty > .material-symbols-outlined { margin-bottom: 12px; font-size: 38px; }
.portal-empty strong { color: #475467; font-size: 15px; }
.portal-empty p { margin: 7px 0 0; font-size: 12px; }

.portal-footer { border-top: 1px solid var(--portal-line); color: #98a2b3; background: #fff; font-size: 13px; }
.portal-footer .portal-container { display: flex; min-height: 66px; align-items: center; justify-content: space-between; }

@media (max-width: 980px) {
    .portal-login-shell { grid-template-columns: 1fr; }
    .portal-login-story { min-height: 310px; padding: 36px 42px; }
    .portal-login-story__copy { padding: 34px 0 18px; }
    .portal-login-story__copy h1 { margin: 14px 0 12px; font-size: 40px; }
    .portal-login-story__copy p { font-size: 15px; }
    .portal-login-panel { min-height: auto; padding: 55px 30px 38px; }
    .portal-login-copyright { margin-top: 42px; }
    #layout-user .portal-test-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
    .portal-container { width: min(100% - 32px, 1180px); }
    .portal-login-story { min-height: 270px; padding: 28px 24px; }
    .portal-login-story__copy { padding: 28px 0 6px; }
    .portal-login-story__copy h1 { font-size: 34px; }
    .portal-login-story__copy p { font-size: 13px; line-height: 1.55; }
    .portal-login-story__status { display: none; }
    .portal-login-panel { padding: 44px 22px 30px; }
    .portal-login-card__head h2 { font-size: 30px; }
    .portal-header__inner { min-height: 68px; }
    .portal-account__name { display: none; }
    .portal-logout { padding: 9px; }
    .portal-logout > span:last-child { display: none; }
    .portal-main { padding: 28px 0 55px; }
    .portal-welcome { min-height: 220px; padding: 32px 28px; }
    .portal-welcome h1 { font-size: 27px; }
    .portal-welcome p { max-width: 250px; line-height: 1.6; }
    .portal-welcome__count { display: none; }
    .portal-section-head { margin-top: 34px; align-items: flex-start; }
    .portal-section-head p { display: none; }
    #layout-user .portal-test-list { grid-template-columns: 1fr; }
    #layout-user .portal-test-list > li > a { min-height: 250px; }
    .portal-footer .portal-container { justify-content: center; }
    .portal-footer .portal-container > span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .portal-redesign *, .portal-redesign *::before, .portal-redesign *::after { scroll-behavior: auto !important; transition: none !important; }
}
