:root {
  --navy: #0a376c;
  --navy-dark: #062750;
  --cyan: #08afe6;
  --cyan-dark: #0098cd;
  --pale: #edf8fd;
  --line: #dce9f1;
  --muted: #687e95;
  --ink: #10273f;
  --white: #fff;
  --danger: #e95858;
  --success: #16a57a;
  --shadow: 0 16px 45px rgba(7, 47, 92, .10);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Arial, Helvetica, sans-serif; color: var(--ink); background: #f7fafc; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.ambient { position: fixed; pointer-events: none; z-index: 0; transform: skewX(-36deg); }
.ambient-one { width: 18px; height: 360px; right: 7%; top: -160px; background: var(--cyan); }
.ambient-two { width: 120px; height: 360px; left: -80px; bottom: -220px; background: var(--navy); }

.auth-screen { min-height: 100vh; display: grid; grid-template-columns: 1.18fr .82fr; position: relative; z-index: 1; overflow: hidden; background: white; }
.auth-brand { position: relative; padding: 58px 7vw; display: flex; flex-direction: column; background: linear-gradient(140deg, #fff 40%, #f4fbff 100%); overflow: hidden; }
.brand-lockup { display: flex; align-items: center; gap: 15px; }
.brand-lockup img { width: 92px; height: auto; }
.brand-lockup strong { display: block; color: var(--navy); text-transform: uppercase; font-style: italic; font-size: 14px; }
.brand-lockup span { display: block; color: var(--muted); text-transform: uppercase; letter-spacing: .15em; font-size: 8px; margin-top: 5px; }
.brand-lockup--large img { width: 145px; }
.brand-lockup--large strong { font-size: 19px; }
.brand-lockup--large span { font-size: 10px; }
.auth-copy { margin: auto 0; max-width: 760px; position: relative; z-index: 2; }
.eyebrow, .page-kicker { font-size: 12px; letter-spacing: .19em; font-weight: 800; color: var(--cyan-dark); }
.auth-copy h1 { margin: 24px 0; font-size: clamp(64px, 7vw, 112px); line-height: .88; color: var(--navy); text-transform: uppercase; font-style: italic; letter-spacing: -.06em; }
.auth-copy h1 em { color: var(--cyan); font-style: inherit; }
.auth-copy p { max-width: 600px; color: var(--muted); font-size: 19px; line-height: 1.6; }
.feature-pills { display: flex; gap: 10px; margin-top: 32px; flex-wrap: wrap; }
.feature-pills span { padding: 9px 14px; border: 1px solid var(--line); color: var(--navy); font-weight: 700; font-size: 12px; background: white; clip-path: polygon(8px 0,100% 0,calc(100% - 8px) 100%,0 100%); }
.slash { position: absolute; transform: skewX(-38deg); }
.slash-a { width: 52px; height: 310px; background: var(--cyan); right: 55px; top: -110px; }
.slash-b { width: 100px; height: 330px; background: var(--navy); right: -75px; top: -65px; }
.auth-panel { display: grid; place-items: center; padding: 48px; background: var(--navy-dark); position: relative; }
.auth-panel::before { content: ''; position: absolute; inset: 0; opacity: .07; background-image: linear-gradient(rgba(255,255,255,.8) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.8) 1px,transparent 1px); background-size: 36px 36px; }
.login-card { width: min(450px,100%); padding: 42px 48px 46px; background: white; box-shadow: 20px 20px 0 rgba(8,175,230,.22); position: relative; z-index: 1; }
.mini-mark { position: absolute; right: 24px; top: 20px; font-size: 56px; color: #e7f5fb; font-weight: 900; font-style: italic; }
.login-card h2 { margin: 0; color: var(--navy); font-size: 31px; }
.login-card form > p { margin: 8px 0 25px; color: var(--muted); font-size: 14px; line-height: 1.4; }
.auth-tabs { display: flex; gap: 22px; margin: 0 0 28px; border-bottom: 1px solid var(--line); }
.auth-tabs button { border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); padding: 0 2px 12px; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.auth-tabs button.active { border-bottom-color: var(--cyan); color: var(--navy); }
label { display: grid; gap: 8px; margin-bottom: 18px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--navy); }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: white; padding: 13px 14px; outline: none; transition: .2s border, .2s box-shadow; text-transform: none; letter-spacing: normal; font-weight: 500; }
input:focus, textarea:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(8,175,230,.12); }
.button { border: 0; padding: 13px 20px; border-radius: 6px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: 14px; transition: .18s transform, .18s background; }
.button:hover { transform: translateY(-2px); }
.button--primary { color: white; background: var(--navy); }
.button--primary:hover { background: var(--cyan-dark); }
.button--cyan { color: white; background: var(--cyan-dark); }
.button--soft { color: var(--navy); background: var(--pale); }
.button--wide { width: 100%; }
.button--small { padding: 9px 13px; font-size: 13px; }
.form-error { min-height: 20px; color: var(--danger); font-size: 13px; margin-top: 10px; }
.form-error.success-message { color: #087b5b; line-height: 1.45; }
.registration-success { text-align: center; padding: 8px 0 2px; }
.pending-icon { width: 76px; height: 76px; margin: 4px auto 22px; display: grid; place-items: center; background: var(--pale); clip-path: polygon(15px 0,100% 0,100% calc(100% - 15px),calc(100% - 15px) 100%,0 100%,0 15px); }
.pending-icon span { width: 42px; height: 42px; display: grid; place-items: center; background: var(--cyan); color: white; font-size: 22px; font-weight: 900; }
.pending-kicker { color: var(--cyan-dark); font-size: 10px; font-weight: 900; letter-spacing: .16em; }
.registration-success h2 { margin: 10px 0 12px; font-size: 29px; }
.registration-success p { margin: 0 auto 24px; max-width: 330px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.pending-account { margin-bottom: 22px; padding: 13px 16px; background: var(--pale); display: flex; align-items: center; justify-content: space-between; text-align: left; }
.pending-account span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.pending-account strong { color: var(--navy); font-size: 14px; }
.demo-accounts { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.demo-accounts span { color: var(--muted); font-size: 12px; margin-right: auto; }
.demo-accounts button { border: 0; color: var(--navy); background: var(--pale); padding: 7px 10px; border-radius: 4px; font-size: 11px; font-weight: 800; }
.demo-accounts a { color: var(--navy); font-size: 11px; font-weight: 800; text-decoration: none; }

.app { min-height: 100vh; display: grid; grid-template-columns: 255px 1fr; position: relative; z-index: 1; }
.sidebar { height: 100vh; position: sticky; top: 0; background: white; border-right: 1px solid var(--line); padding: 29px 21px; display: flex; flex-direction: column; z-index: 10; }
.nav { margin-top: 54px; display: grid; gap: 7px; }
.nav-item { border: 0; background: transparent; display: flex; align-items: center; gap: 13px; padding: 13px 14px; border-radius: 6px; color: var(--muted); font-weight: 700; text-align: left; }
.nav-item i { display: grid; place-items: center; width: 28px; height: 28px; background: #f4f8fb; color: var(--navy); font-style: normal; border-radius: 5px; }
.nav-item:hover, .nav-item.active { background: var(--pale); color: var(--navy); }
.nav-item.active { position: relative; }
.nav-item.active::after { content: ''; position: absolute; right: -21px; width: 5px; height: 32px; background: var(--cyan); }
.sidebar-bottom { margin-top: auto; }
.season-card { background: var(--navy); color: white; padding: 18px; position: relative; overflow: hidden; clip-path: polygon(0 0,100% 0,100% calc(100% - 13px),calc(100% - 13px) 100%,0 100%); }
.season-card::after { content: ''; position: absolute; right: -35px; top: -40px; width: 30px; height: 120px; background: var(--cyan); transform: skewX(-35deg); }
.season-card span { color: #90daef; font-size: 10px; text-transform: uppercase; letter-spacing: .14em; }
.season-card strong { display: block; margin-top: 8px; font-size: 15px; font-style: italic; text-transform: uppercase; }
.season-line { height: 4px; background: rgba(255,255,255,.15); margin-top: 17px; }
.season-line b { display: block; height: 100%; width: 38%; background: var(--cyan); }
.logout { border: 0; background: transparent; color: var(--muted); padding: 20px 5px 0; display: flex; width: 100%; justify-content: space-between; font-size: 12px; }
.main { min-width: 0; }
.topbar { height: 103px; padding: 0 42px; display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.86); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 8; }
.topbar h2 { margin: 5px 0 0; color: var(--navy); font-size: 25px; }
.topbar-actions { display: flex; align-items: center; gap: 28px; }
.season-top { display: flex; align-items: center; gap: 10px; color: var(--navy); font-size: 10px; letter-spacing: .1em; }
.season-top strong { padding: 8px 11px; background: var(--navy); color: white; font-size: 9px; }
.season-top span { color: var(--muted); font-weight: 800; }
.profile { display: flex; align-items: center; gap: 11px; }
.profile strong { display: block; font-size: 13px; color: var(--navy); }
.profile span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.avatar { width: 42px; height: 42px; display: grid; place-items: center; color: white; background: var(--navy); font-size: 12px; font-weight: 900; clip-path: polygon(9px 0,100% 0,100% calc(100% - 9px),calc(100% - 9px) 100%,0 100%,0 9px); }
.content { padding: 34px 42px 60px; max-width: 1500px; margin: 0 auto; }
.mobile-menu { display: none; border: 0; background: var(--pale); color: var(--navy); padding: 8px 10px; border-radius: 5px; }

.hero { background: var(--navy); color: white; padding: 42px 46px; min-height: 245px; display: grid; grid-template-columns: 1.3fr .7fr; align-items: center; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.hero::before, .hero::after { content: ''; position: absolute; background: var(--cyan); transform: skewX(-37deg); }
.hero::before { width: 38px; height: 350px; right: 165px; top: -140px; }
.hero::after { width: 90px; height: 360px; right: 38px; top: -105px; background: rgba(255,255,255,.07); }
.hero-content { position: relative; z-index: 1; }
.hero .eyebrow { color: #8fe5fa; }
.hero h1 { margin: 14px 0 11px; font-size: clamp(38px,4vw,61px); line-height: 1; text-transform: uppercase; font-style: italic; }
.hero p { margin: 0; color: #bfd1e4; max-width: 620px; }
.hero-stat { position: relative; z-index: 1; justify-self: end; text-align: right; }
.hero-stat strong { display: block; font-size: 96px; font-style: italic; line-height: .8; color: var(--cyan); }
.hero-stat span { display: block; font-size: 11px; letter-spacing: .18em; margin-top: 18px; }
.grid { display: grid; gap: 22px; }
.grid--stats { grid-template-columns: repeat(3,1fr); margin: 24px 0; }
.grid--two { grid-template-columns: minmax(0,1.4fr) minmax(320px,.6fr); }
.stat-card, .panel { background: white; border: 1px solid var(--line); box-shadow: 0 8px 28px rgba(7,47,92,.05); }
.stat-card { padding: 22px 24px; display: flex; justify-content: space-between; align-items: center; }
.stat-card span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .09em; }
.stat-card strong { display: block; color: var(--navy); font-size: 31px; margin-top: 7px; }
.stat-card i { width: 45px; height: 45px; display: grid; place-items: center; background: var(--pale); color: var(--cyan-dark); font-style: normal; font-weight: 900; clip-path: polygon(8px 0,100% 0,calc(100% - 8px) 100%,0 100%); }
.panel-header { min-height: 70px; border-bottom: 1px solid var(--line); padding: 19px 23px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.panel-header h3 { margin: 0; color: var(--navy); font-size: 18px; }
.panel-header span { color: var(--muted); font-size: 12px; }
.panel-body { padding: 22px 23px; }
.contest-meta { display: flex; gap: 18px; color: var(--muted); font-size: 12px; margin: 13px 0 24px; flex-wrap: wrap; }
.contest-meta b { color: var(--navy); }
.progress { height: 7px; background: var(--pale); overflow: hidden; }
.progress b { display: block; height: 100%; background: var(--cyan); }
.problem-list { display: grid; gap: 10px; margin-top: 20px; }
.problem-row { display: grid; grid-template-columns: 46px 1fr auto auto; gap: 14px; align-items: center; border: 1px solid var(--line); padding: 12px; background: white; transition: .18s transform, .18s border; }
.problem-row:hover { transform: translateX(4px); border-color: #a9dced; }
.problem-letter { width: 42px; height: 42px; display: grid; place-items: center; background: var(--navy); color: white; font-weight: 900; font-size: 18px; font-style: italic; }
.problem-row.solved .problem-letter { background: var(--success); }
.problem-name strong { display: block; color: var(--navy); font-size: 14px; }
.problem-name span { color: var(--muted); font-size: 11px; }
.points { color: var(--cyan-dark); font-weight: 900; font-size: 13px; }
.status-chip { display: inline-flex; align-items: center; padding: 5px 9px; background: var(--pale); color: var(--navy); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.status-chip.accepted { color: #087b5b; background: #e3f8f1; }
.status-chip.wrong_answer, .status-chip.runtime_error { color: #ae3d3d; background: #fff0f0; }
.ranking { width: 100%; border-collapse: collapse; }
.ranking th, .ranking td { border-bottom: 1px solid var(--line); padding: 12px 8px; text-align: left; font-size: 12px; }
.ranking th { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 9px; }
.ranking td strong { color: var(--navy); }
.ranking .rank { font-size: 17px; font-style: italic; font-weight: 900; color: var(--cyan-dark); }
.ranking tr.me { background: var(--pale); }
.empty { padding: 35px; text-align: center; color: var(--muted); }

.workspace { display: grid; grid-template-columns: minmax(380px,.8fr) minmax(500px,1.2fr); gap: 18px; height: calc(100vh - 170px); min-height: 620px; }
.problem-pane, .code-pane { min-height: 0; background: white; border: 1px solid var(--line); display: flex; flex-direction: column; }
.problem-pane-head { padding: 24px; border-bottom: 1px solid var(--line); }
.problem-title-line { display: flex; align-items: center; gap: 15px; }
.problem-title-line .problem-letter { width: 52px; height: 52px; font-size: 22px; }
.problem-title-line h2 { margin: 0; color: var(--navy); font-size: 24px; }
.problem-title-line p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.problem-scroll { overflow: auto; padding: 25px; }
.problem-scroll h4 { color: var(--navy); margin: 28px 0 9px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.problem-scroll p { line-height: 1.65; color: #40566d; }
.sample { border: 1px solid var(--line); margin: 13px 0; }
.sample-head { display: grid; grid-template-columns: 1fr 1fr; background: var(--pale); color: var(--navy); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.sample-head span { padding: 8px 11px; }
.sample-body { display: grid; grid-template-columns: 1fr 1fr; }
.sample pre { margin: 0; padding: 13px; overflow: auto; font: 13px/1.5 'SFMono-Regular',Consolas,monospace; }
.sample pre + pre { border-left: 1px solid var(--line); }
.code-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: #0b233d; color: white; }
.code-toolbar-left { display: flex; align-items: center; gap: 12px; }
.code-toolbar select { width: 150px; padding: 8px 10px; border-color: #294a6a; background: #102f4f; color: white; }
.save-state { font-size: 10px; color: #93abc0; }
.editor-shell { flex: 1; min-height: 280px; display: grid; grid-template-columns: 54px 1fr; background: #071b30; overflow: hidden; }
.line-numbers { padding: 18px 12px; text-align: right; white-space: pre; overflow: hidden; color: #49647f; font: 14px/1.65 'SFMono-Regular',Consolas,monospace; user-select: none; }
.code-editor { resize: none; border: 0; border-radius: 0; padding: 18px 18px; color: #dceafb; background: #071b30; box-shadow: none !important; font: 14px/1.65 'SFMono-Regular',Consolas,monospace; tab-size: 4; }
.console { height: 230px; border-top: 1px solid #243c54; background: #0a2138; display: flex; flex-direction: column; }
.console-tabs { display: flex; border-bottom: 1px solid #243c54; }
.console-tabs button { border: 0; background: transparent; color: #7892aa; padding: 10px 15px; font-size: 11px; font-weight: 800; }
.console-tabs button.active { color: white; border-bottom: 2px solid var(--cyan); }
.console-body { padding: 13px 15px; overflow: auto; color: #bdd1e2; font: 12px/1.55 'SFMono-Regular',Consolas,monospace; white-space: pre-wrap; }
.code-actions { display: flex; gap: 10px; }
.code-actions .button { padding: 9px 13px; font-size: 12px; }
.run-result { display: grid; gap: 8px; }
.result-banner { padding: 11px 13px; display: flex; align-items: center; justify-content: space-between; font-family: Arial,sans-serif; font-weight: 800; }
.result-banner.accepted { background: rgba(22,165,122,.15); color: #57d8b1; }
.result-banner.failed { background: rgba(233,88,88,.15); color: #ff9999; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; gap: 15px; }
.toolbar p { color: var(--muted); margin: 0; }
.contest-catalog { display: grid; gap: 20px; }
.contest-card { overflow: hidden; }
.contest-card.joined { border-left: 5px solid var(--cyan); }
.contest-card .panel-header > div { display: grid; gap: 7px; }
.contest-card .panel-header .status-chip { width: max-content; }
.contest-description { margin: 0; color: var(--muted); line-height: 1.55; }
.join-callout { min-height: 82px; padding: 17px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; background: var(--pale); }
.join-callout strong { display: block; color: var(--navy); font-size: 14px; }
.join-callout span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.submission-list { display: grid; gap: 9px; }
.submission { display: grid; grid-template-columns: 70px 1fr 110px 100px 130px; align-items: center; gap: 12px; padding: 14px 17px; background: white; border: 1px solid var(--line); }
.submission > b { color: var(--navy); }
.submission small { color: var(--muted); }
.admin-layout { display: grid; grid-template-columns: 1fr 1.1fr; gap: 22px; align-items: start; }
.admin-form textarea { min-height: 105px; resize: vertical; }
.admin-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.helper { color: var(--muted); font-size: 11px; line-height: 1.5; margin-top: -9px; margin-bottom: 14px; }
.architecture { display: grid; gap: 12px; }
.architecture-item { padding: 15px; border: 1px solid var(--line); display: flex; gap: 13px; align-items: flex-start; }
.architecture-item b { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; background: var(--navy); color: white; font-size: 11px; }
.architecture-item strong { display: block; color: var(--navy); font-size: 13px; }
.architecture-item span { color: var(--muted); font-size: 11px; line-height: 1.5; }
.toast { position: fixed; right: 25px; bottom: 25px; z-index: 100; min-width: 250px; max-width: 420px; padding: 14px 18px; background: var(--navy); color: white; box-shadow: var(--shadow); transform: translateY(130%); transition: .25s transform; font-size: 13px; }
.toast.show { transform: translateY(0); }
.toast.error { background: #9e3f48; }
.loading { min-height: 350px; display: grid; place-items: center; color: var(--muted); }
.loading::before { content: ''; width: 35px; height: 35px; border: 4px solid var(--line); border-top-color: var(--cyan); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1050px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-brand { min-height: 46vh; padding: 35px 7vw; }
  .auth-panel { padding: 45px 20px; }
  .auth-copy h1 { font-size: 60px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; transform: translateX(-100%); transition: .25s transform; width: 255px; }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 45px rgba(0,0,0,.18); }
  .mobile-menu { display: block; }
  .topbar { padding: 0 20px; justify-content: flex-start; gap: 18px; }
  .topbar-actions { margin-left: auto; }
  .content { padding: 25px 20px 50px; }
  .workspace { grid-template-columns: 1fr; height: auto; }
  .problem-pane { max-height: 600px; }
  .code-pane { height: 700px; }
}

@media (max-width: 720px) {
  .auth-copy p, .feature-pills { display: none; }
  .brand-lockup--large img { width: 100px; }
  .auth-copy h1 { font-size: 47px; }
  .login-card { padding: 32px 25px; }
  .profile > div:last-child, .season-top { display: none; }
  .topbar { height: 82px; }
  .topbar h2 { font-size: 18px; }
  .hero { grid-template-columns: 1fr; padding: 32px 27px; }
  .hero-stat { display: none; }
  .grid--stats, .grid--two, .admin-layout { grid-template-columns: 1fr; }
  .problem-row { grid-template-columns: 40px 1fr auto; }
  .problem-row .button { display: none; }
  .submission { grid-template-columns: 45px 1fr auto; }
  .submission .hide-mobile { display: none; }
  .admin-form .row { grid-template-columns: 1fr; }
  .join-callout { align-items: stretch; flex-direction: column; }
}
