
:root {
  color-scheme: dark;
  --bg0: #000000;
  --bg1: #04102a;
  --bg2: #0a1f4d;
  --ink: #e8f1ff;
  --muted: #9eb0cc;
  --line: rgba(160, 196, 255, 0.18);
  --card: rgba(10, 24, 58, 0.62);
  --accent: #7eb6ff;
  --accent-2: #3d7dff;
  --danger: #ffb4b4;
  --ok: #b6f3c8;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --pad: 16px;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg0: #ffffff;
  --bg1: #eef5ff;
  --bg2: #d7e8ff;
  --ink: #10213d;
  --muted: #4d6284;
  --line: rgba(20, 60, 120, 0.14);
  --card: rgba(255, 255, 255, 0.78);
  --accent: #1d5fd0;
  --accent-2: #3c86ef;
  --danger: #9d1c1c;
  --ok: #0d6b3a;
  --shadow: 0 16px 40px rgba(20, 60, 120, 0.12);
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: system-ui, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
  line-height: 1.45;
  background:
    radial-gradient(900px 480px at 12% -10%, rgba(90, 160, 255, 0.28), transparent 60%),
    linear-gradient(180deg, var(--bg0) 0%, var(--bg1) 46%, var(--bg2) 100%);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #9ecbff; outline-offset: 3px; }
.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus { left: 12px; top: 12px; background: #fff; color: #000; padding: 8px; z-index: 20; }
.top-theme {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 40;
}
.icon-btn, .btn, .lang-btn, .menu-btn {
  min-height: 48px;
  min-width: 48px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(12px);
  padding: 0 16px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-decoration: none;
  font-weight: 680;
  gap: 8px;
}
.btn.primary { background: linear-gradient(180deg, #5aa2ff, #2f6fe0); color: #fff; border-color: transparent; }
html[data-theme="light"] .btn.primary { color: #fff; }
.btn.ghost { background: transparent; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.home {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 88px 16px calc(72px + env(safe-area-inset-bottom));
}
.home-card { width: min(440px, 100%); text-align: center; }
.mark {
  width: 84px;
  height: 84px;
  margin: 0 auto 12px;
  filter: drop-shadow(0 8px 20px rgba(80, 150, 255, 0.35));
}
.brand-title {
  margin: 0 0 8px;
  font-size: clamp(2.5rem, 7vw, 4.6rem);
  letter-spacing: -0.045em;
  line-height: 1.02;
  font-weight: 760;
}
.hint { margin: 0 0 22px; color: var(--muted); }
.corner {
  position: fixed;
  z-index: 30;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.logo-btn, .ai-btn {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(14px);
  display: grid;
  place-items: center;
  color: var(--ink);
  text-decoration: none;
  font-weight: 760;
  box-shadow: var(--shadow);
}
.ai-btn { color: #fff; background: linear-gradient(160deg, #3d7dff, #163a86); }
.admin-link {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(10px, env(safe-area-inset-bottom));
  text-align: center;
  color: var(--muted);
  opacity: 0.18;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 12px;
}
.admin-link:hover, .admin-link:focus { opacity: 1; }
.drawer-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 50;
}
.drawer-back[hidden], [hidden] { display: none !important; }
.drawer {
  position: fixed;
  z-index: 60;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(380px, 92vw);
  background: rgba(6, 16, 40, 0.94);
  color: #e8f1ff;
  border-right: 1px solid var(--line);
  padding: calc(20px + env(safe-area-inset-top)) 18px 24px;
  transform: translateX(-105%);
  transition: transform 0.28s ease;
  overflow: auto;
}
html[data-theme="light"] .drawer { background: rgba(255, 255, 255, 0.96); color: #10213d; }
.drawer.open { transform: none; }
.drawer h2 { margin: 8px 0; font-size: 1.25rem; }
.drawer p { margin: 8px 0; }
.langs { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  padding: 16px;
}
.auth-wrap, .page {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 76px 16px calc(28px + env(safe-area-inset-bottom));
}
.auth-wrap { width: min(460px, 100%); }
label { display: block; font-size: 0.92rem; margin-bottom: 6px; }
.field { margin-bottom: 12px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], input[type="search"], select, textarea {
  width: 100%;
  min-height: 48px;
  font-size: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  padding: 10px 12px;
}
html[data-theme="light"] input, html[data-theme="light"] select, html[data-theme="light"] textarea {
  background: #fff;
}
textarea { min-height: 96px; resize: vertical; }
.row-inline { display: flex; gap: 8px; align-items: center; }
.row-inline > * { flex: 1; }
.passwrap { position: relative; }
.passwrap input { padding-right: 96px; }
.passwrap button {
  position: absolute;
  right: 6px;
  top: 6px;
  min-height: 36px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--accent);
}
.alert {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: rgba(255, 180, 180, 0.12);
  color: var(--danger);
  border: 1px solid rgba(255, 180, 180, 0.3);
}
.alert.ok { background: rgba(120, 220, 160, 0.12); color: var(--ok); border-color: rgba(120, 220, 160, 0.3); }
.codebox input {
  letter-spacing: 0.55em;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: rgba(4, 12, 32, 0.72);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
html[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.8); }
.brand-link { font-weight: 760; text-decoration: none; color: inherit; letter-spacing: -0.03em; }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.shell { display: block; }
.side {
  display: none;
  padding: 12px;
}
.side.open { display: block; }
.side a, .side button.linkish {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  margin-bottom: 6px;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
}
.side a.active, .side a:hover { background: rgba(120, 170, 255, 0.16); }
.main { padding: 12px 16px 32px; }
.menu-btn { display: inline-flex; }
h1 { font-size: clamp(1.5rem, 2vw + 1rem, 2.2rem); letter-spacing: -0.03em; margin: 0 0 12px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
}
.tabs a.active { background: #2f6fe0; color: #fff; border-color: transparent; }
.day-card { margin-bottom: 12px; }
.day-card h2 { margin: 0 0 8px; font-size: 1.05rem; }
.lesson {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.chart { width: 100%; height: auto; }
.bar-label { font-size: 0.85rem; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.grid-2 { display: grid; gap: 12px; }
.stars { letter-spacing: 0.08em; }
.check { display: flex; align-items: center; gap: 8px; min-height: 48px; }
footer.tiny { text-align: center; color: var(--muted); padding: 18px 12px 28px; font-size: 0.9rem; }
.ripple {
  position: fixed;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 6px rgba(120, 180, 255, 0.35);
  pointer-events: none;
  z-index: 80;
  animation: rip 0.5s ease-out forwards;
}
html[data-theme="light"] .ripple {
  border-color: rgba(20, 70, 160, 0.85);
  box-shadow: 0 0 0 6px rgba(40, 120, 255, 0.28);
}
@keyframes rip { to { transform: scale(6); opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card, .home-card { animation: rise 0.35s ease; }
@media (max-width: 760px) {
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { margin-bottom: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 6px 8px; }
  table.cards td { border: 0; display: flex; justify-content: space-between; gap: 12px; }
  table.cards td::before { content: attr(data-label); color: var(--muted); margin-right: 8px; }
}
@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100dvh - 70px); }
  .side { display: block; border-right: 1px solid var(--line); }
  .menu-btn { display: none; }
  .main { padding: 20px 28px 40px; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .auth-wrap { margin-top: 24px; }
}
@media (min-width: 1920px) {
  html { font-size: clamp(20px, 1.15vw, 30px); }
  .home { padding-left: 8vw; padding-right: 8vw; }
  .logo-btn, .ai-btn { width: 72px; height: 72px; }
}
html.tv { font-size: clamp(20px, 1.5vw, 32px); }
html.tv .btn, html.tv .icon-btn, html.tv a, html.tv button, html.tv input, html.tv select {
  min-height: 56px;
}
html.tv .home { padding-left: 7vw; padding-right: 7vw; }
html.tv .main { padding-left: 4vw; padding-right: 4vw; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .ripple { display: none !important; }
}
