
:root {
  --bg0: #050306;
  --bg1: #120014;
  --bg2: #2a0614;
  --card: rgba(16, 8, 12, 0.72);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f7f2f4;
  --muted: #c9b3bc;
  --accent: #ff86ab;
  --accent-strong: #c01458;
  --on-accent: #ffffff;
  --danger: #ffb4c4;
  --ok: #b7f0d8;
  --warn: #f3dd9a;
  --focus: #ff86ab;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --radius: 20px;
  --gap: 12px;
  --tap: 48px;
  --font: system-ui, "Segoe UI", "Noto Sans", "DejaVu Sans", sans-serif;
}
html.light {
  --bg0: #fff7f9;
  --bg1: #fff1f5;
  --bg2: #ffe4ec;
  --card: #ffffff;
  --line: rgba(90, 16, 40, 0.12);
  --text: #2a1020;
  --muted: #7a5364;
  --accent: #b01252;
  --accent-strong: #9d1048;
  --on-accent: #ffffff;
  --danger: #8d1d1d;
  --ok: #0d6b48;
  --warn: #8a5a00;
  --focus: #b01252;
  --shadow: 0 12px 30px rgba(90, 16, 40, 0.08);
}
* { box-sizing: border-box; }
html { font-size: clamp(16px, 0.45vw + 15px, 22px); }
html, body { margin: 0; max-width: 100%; overflow-x: hidden; }
body {
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  letter-spacing: -0.011em;
  background:
    radial-gradient(980px 520px at 50% -8%, rgba(255, 0, 77, 0.28), transparent 62%),
    radial-gradient(640px 420px at 100% 8%, rgba(89, 0, 30, 0.55), transparent 58%),
    linear-gradient(180deg, #050306 0%, #120014 48%, #2a0616 100%);
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
html.dark body, html:not(.light) body {
  background:
    radial-gradient(900px 420px at 50% 0%, rgba(255, 0, 77, 0.12), transparent 62%),
    #050306;
}
html.light body {
  background:
    radial-gradient(800px 360px at 50% -10%, rgba(255, 80, 140, 0.18), transparent 70%),
    linear-gradient(180deg, #fff8fa 0%, #fff1f5 100%);
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button {
  appearance: none; -webkit-appearance: none; background: transparent; border: 0;
  padding: 0; line-height: 1.2; text-align: center;
}
form { margin: 0; }
button, .btn, .navlink, .icon-btn, .logo-btn { cursor: pointer; }
:focus { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip {
  position: absolute; left: 12px; top: -80px; background: var(--card); color: var(--text);
  padding: 12px 16px; z-index: 90; border-radius: 12px;
}
.skip:focus { top: 12px; }
.topbar {
  display: flex; align-items: center; gap: var(--gap);
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  position: sticky; top: 0; z-index: 15;
  background: rgba(8, 4, 8, 0.62);
  backdrop-filter: blur(16px);
}
html.light .topbar { background: rgba(255, 247, 250, 0.82); }
.spacer { flex: 1; }
.home { min-height: 100vh; display: flex; flex-direction: column; }
.hero {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  margin: 4px 12px 18px;
  padding: 36px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left));
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    radial-gradient(90% 70% at 50% 115%, rgba(255, 80, 150, 0.22), transparent 58%),
    linear-gradient(180deg, rgba(18, 0, 20, 0.55), rgba(255, 0, 77, 0.16));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05);
}
html.light .hero {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 214, 226, 0.55));
  border-color: rgba(176, 18, 82, 0.1);
}
.kicker { letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-size: 0.72rem; margin: 0 0 10px; }
.wordmark { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hero h1 {
  font-size: clamp(2.5rem, 7vw, 4.6rem); line-height: 0.96; letter-spacing: -0.05em; margin: 0; font-weight: 650;
  background: linear-gradient(180deg, #ffffff 20%, #ff86ab 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
html.light .hero h1 {
  background: linear-gradient(180deg, #3a1024 10%, #c01458 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { max-width: 28rem; color: var(--muted); margin: 14px 0 22px; font-size: 1.02rem; }
.hero-actions, .stack { display: flex; flex-direction: column; align-items: stretch; gap: var(--gap); width: min(100%, 440px); }
.btn, .icon-btn, .navlink, .logo-btn {
  min-height: var(--tap); border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04); color: var(--text); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 16px; font-size: 16px; line-height: 1.2; text-align: center;
  white-space: normal; box-sizing: border-box; font-weight: 500;
}
.btn.primary {
  background: linear-gradient(135deg, #e01668, #6e0030);
  color: var(--on-accent); border-color: transparent; font-weight: 600;
  box-shadow: 0 8px 22px rgba(255, 0, 77, 0.22);
}
.btn.ghost, .icon-btn { background: transparent; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.hero-actions > .btn,
.stack > .btn,
.stack > form,
.drawer-card > .btn,
.drawer-card > a.btn,
.card > .btn,
.card > a.btn,
.card form .btn,
.side .navlink,
.side-logout,
.side-logout .btn { width: 100%; }
.btn-row .btn, .tabs .btn, .toolbar > .btn { width: auto; }
.icon-btn {
  width: var(--tap); height: var(--tap); min-width: var(--tap); padding: 0; flex: 0 0 var(--tap);
}
.ico { width: 22px; height: 22px; display: block; }
.logo-btn .ico { width: 36px; height: 36px; }
.mark { width: 44px; height: 44px; color: var(--accent); }
.mark.tiny { width: 28px; height: 28px; }
.left-tools { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.home-top { align-items: flex-start; }
.ai-btn { width: 64px; min-width: 64px; height: var(--tap); padding: 0; flex: 0 0 64px; }
.logo-btn {
  position: relative; z-index: 2; flex: 0 0 64px;
  width: 64px; height: 64px; min-width: 64px; padding: 0; border-radius: 20px;
  background: var(--card); color: var(--text); box-shadow: var(--shadow); backdrop-filter: blur(16px);
}
.admin-link {
  align-self: center; margin: 8px auto 18px; min-height: var(--tap); display: inline-flex; align-items: center;
  padding: 0 18px; color: var(--muted); text-decoration: none; opacity: 0.32; border-radius: 12px;
}
.admin-link:hover, .admin-link:focus { opacity: 1; }
@media (hover: none) { .admin-link { opacity: 0.62; } }
.drawer {
  position: fixed; inset: 0 auto 0 0; width: min(440px, 100%); z-index: 30;
  transform: translateX(-105%); transition: transform 0.25s ease; padding: max(12px, env(safe-area-inset-top)) 12px 12px max(12px, env(safe-area-inset-left));
  pointer-events: none;
}
.drawer.open { transform: none; pointer-events: auto; }
.drawer-card, .card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(0, 0, 0, 0.28)),
    rgba(14, 7, 11, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  padding: 22px 20px;
}
html.light .drawer-card, html.light .card {
  background: #fff;
  border-color: rgba(176, 18, 82, 0.1);
}
.drawer-card { height: 100%; display: flex; flex-direction: column; gap: var(--gap); overflow: auto; }
.hello { font-size: 1.35rem; margin: 0; }
.sub, .dev, .lead, .muted { color: var(--muted); }
.dev { margin-top: 0; }
.lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: stretch; }
.lang-grid form { margin: 0; display: flex; min-width: 0; }
.lang-grid .btn { width: 100%; min-height: 52px; padding: 8px 10px; }
.text-link { color: var(--accent); min-height: var(--tap); display: inline-flex; align-items: center; }
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.narrow { width: min(100%, 520px); }
.card h1, .content h2, .day h2, .day h3 { margin: 0 0 8px; letter-spacing: -0.03em; font-weight: 650; }
.card h1 { font-size: 1.7rem; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.95rem; }
input, select, textarea {
  min-height: var(--tap); font-size: 16px; width: 100%; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); padding: 10px 12px;
}
html.light input, html.light select, html.light textarea { background: #fff; }
textarea { min-height: 96px; resize: vertical; }
.pass-row { position: relative; display: block; width: 100%; }
.pass-row input { width: 100%; padding-right: 56px; }
.pass-toggle,
.card form .btn.pass-toggle,
.stack .pass-toggle {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 48px; min-width: 48px; max-width: 48px; height: auto; min-height: 0;
  margin: 0; padding: 0; flex: none;
  border-radius: 0 12px 12px 0;
  border-top: 0; border-right: 0; border-bottom: 0;
  border-left: 1px solid var(--line);
  background: transparent;
}
.pass-toggle .eye-shut { display: none; }
.pass-toggle.is-shown .eye-open { display: none; }
.pass-toggle.is-shown .eye-shut { display: block; }
.otp { position: relative; height: 64px; display: block; }
.otp-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; height: 64px; }
.otp-boxes i {
  border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-variant-numeric: tabular-nums; background: rgba(0,0,0,.18);
}
html.light .otp-boxes i { background: #fff; }
.otp-field {
  position: absolute; inset: 0; width: 100%; height: 64px; opacity: 0.02; caret-color: var(--accent);
  letter-spacing: 0; text-align: center;
}
.link-row { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.demo-box { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--gap); }
.banner { background: rgba(243, 221, 154, 0.15); border: 1px solid var(--warn); padding: 10px 12px; border-radius: 12px; }
.shell { min-height: 100vh; display: block; }
.side {
  background: rgba(8, 3, 8, 0.88); border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 18px 12px 20px; display: flex; flex-direction: column; gap: 6px;
}
html.light .side { background: #fff7fa; }
.brand-row { display: flex; gap: 10px; align-items: center; padding: 4px 8px 12px; }
.brand-row strong { display: block; }
.brand-row small, .who small { color: var(--muted); }
.navlink { justify-content: flex-start; padding: 0 14px; width: 100%; border-color: transparent; background: transparent; }
.navlink.active { background: rgba(255, 0, 77, 0.16); color: var(--text); }
.side-logout { margin-top: auto; width: 100%; }
.maincol { min-width: 0; }
.who { display: flex; flex-direction: column; min-width: 0; }
.who strong, .who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 8px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 16px; max-width: 1040px; }
.grid-cards, .card-list, .split { display: grid; gap: var(--gap); }
.stat-value { font-size: clamp(1.6rem, 3vw, 2.4rem); margin: 4px 0; }
.toolbar, .btn-row, .tabs { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: stretch; }
.toolbar > .btn, .btn-row > .btn, .btn-row form, .tabs > .btn { flex: 1 1 148px; }
.toolbar.wrap label, .toolbar label { flex: 1 1 180px; min-width: 140px; }
.week-label { margin: 0; flex: 1 1 180px; min-height: var(--tap); display: flex; align-items: center; justify-content: center; text-align: center; }
.week-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.day.today { border-color: var(--accent); }
.lesson { padding: 8px 0; border-top: 1px solid var(--line); }
.lesson .time { margin: 0; color: var(--accent); font-variant-numeric: tabular-nums; }
.chip { display: inline-flex; min-height: 32px; align-items: center; border-radius: 999px; padding: 0 10px; border: 1px solid var(--line); margin: 4px 6px 0 0; }
.chip.hw { border-color: var(--warn); }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.you { background: rgba(126, 182, 255, 0.12); }
.pre { white-space: pre-wrap; }
.user-card, .hw { display: flex; flex-direction: column; gap: var(--gap); }
.btn-row form { margin: 0; display: flex; }
.btn-row form .btn { width: 100%; }
.hot { border-color: var(--warn); }
.chart { width: 100%; height: 180px; }
.chart rect { fill: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 0; margin: 8px 0 0; }
.legend li { list-style: none; }
.plain { margin: 0; padding-left: 18px; }
.empty { text-align: center; padding: 12px; }
.flash-wrap { position: fixed; right: 12px; bottom: 12px; z-index: 70; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 24px)); }
.flash { border-radius: 14px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.flash-ok { border-color: var(--ok); }
.flash-err { border-color: var(--danger); }
.ripple-dot {
  position: fixed; width: 10px; height: 10px; border-radius: 50%; pointer-events: none; z-index: 90;
  background: #000; border: 2px solid #8ec0ff;
  box-shadow: 0 0 0 1px #000, 0 0 0 3px rgba(47, 125, 246, 0.55), 0 0 10px #2f7df6;
  transform: translate(-50%, -50%);
  animation: rip .42s ease-out forwards;
}
@keyframes rip {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(.7); }
  35% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}
@media (max-width: 979px) {
  .side {
    position: fixed; z-index: 25; inset: 0 auto 0 0; width: min(320px, 88vw); height: 100vh;
    transform: translateX(-105%); transition: transform .25s ease; overflow: auto;
  }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
}
@media (min-width: 980px) {
  .shell { display: grid; grid-template-columns: 270px 1fr; }
  .side { position: sticky; top: 0; height: 100vh; transform: none !important; }
  .menu-btn { display: none; }
  .split { grid-template-columns: 1fr 1fr; }
  .grid-cards { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
@media (max-width: 760px) {
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 16px; padding: 6px 10px; }
  table.data td { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; border: 0; }
  table.data td::before { content: attr(data-label); color: var(--muted); flex: 1 1 40%; }
  table.data td select, table.data td input, table.data td .btn { width: auto; max-width: 100%; flex: 1 1 140px; min-width: 0; }
  table.data td form { margin: 0 0 0 auto; }
}
@media (min-width: 1600px) {
  .btn, .navlink { min-height: 64px; font-size: 1.15rem; }
  .icon-btn { width: 72px; height: 72px; min-width: 72px; flex-basis: 72px; }
  .ai-btn, .logo-btn { width: 72px; min-width: 72px; }
  .logo-btn { height: 72px; }
  .logo-btn .ico { width: 42px; height: 42px; }
}
html.light .btn:not(.primary):not(.ghost):not(.pass-toggle),
html.light .logo-btn { background: #fff; }
html.light .btn.ghost, html.light .icon-btn, html.light .navlink { background: transparent; }
html.light .navlink.active { background: rgba(192, 20, 88, 0.12); }
html.light .btn.primary { background: linear-gradient(135deg, #d41462, #8d1248); color: #fff; }
.stat-value { letter-spacing: -0.04em; font-weight: 650; }
.chip { background: rgba(255, 255, 255, 0.04); }
html.light .chip { background: #fff; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .ripple-dot { opacity: 1; transform: translate(-50%, -50%); }
}
