:root {
  --ink: #0c0f14;
  --ink-soft: rgba(12, 15, 20, 0.72);
  --paper: rgba(255, 252, 248, 0.06);
  --paper2: rgba(255, 252, 248, 0.12);
  --line: rgba(255, 252, 248, 0.14);
  --accent: #f4b942;
  --accent2: #3dd6c6;
  --text: #f2efe8;
  --muted: rgba(242, 239, 232, 0.62);
  --radius: 18px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --font: "PT Sans", system-ui, sans-serif;
  --font-display: "Unbounded", var(--font);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--ink);
  line-height: 1.45;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg__mesh {
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(ellipse 80% 50% at 20% 20%, rgba(61, 214, 198, 0.35), transparent 55%),
    radial-gradient(ellipse 70% 60% at 85% 15%, rgba(244, 185, 66, 0.28), transparent 50%),
    radial-gradient(ellipse 60% 70% at 50% 90%, rgba(120, 90, 220, 0.22), transparent 55%),
    linear-gradient(165deg, #0a0d12 0%, #121a24 45%, #0d141c 100%);
}

.bg__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: float 18s ease-in-out infinite;
}

.bg__blob--1 {
  width: min(55vw, 420px);
  height: min(55vw, 420px);
  left: -8%;
  top: 18%;
  background: radial-gradient(circle, rgba(61, 214, 198, 0.9), transparent 70%);
  animation-delay: -2s;
}

.bg__blob--2 {
  width: min(48vw, 380px);
  height: min(48vw, 380px);
  right: -5%;
  top: 8%;
  background: radial-gradient(circle, rgba(244, 185, 66, 0.85), transparent 68%);
  animation-delay: -7s;
}

.bg__blob--3 {
  width: min(60vw, 480px);
  height: min(60vw, 480px);
  left: 25%;
  bottom: -15%;
  background: radial-gradient(circle, rgba(140, 110, 255, 0.5), transparent 72%);
  animation-delay: -12s;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(3%, -4%) scale(1.05);
  }
  66% {
    transform: translate(-4%, 3%) scale(0.96);
  }
}

.bg__grain {
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.glass {
  background: var(--paper);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.onboard {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
}

.onboard__card {
  width: min(100%, 420px);
  padding: 28px 26px 24px;
}

.onboard__step {
  margin: 0 0 10px;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.onboard__title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.2;
}

.onboard__hint {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

.onboard__err {
  margin: 10px 0 0;
  color: #ff9b9b;
  font-size: 0.88rem;
}

.onboard__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 22px;
  flex-wrap: wrap;
}

.onboard__actions #onBack {
  margin-right: auto;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__lbl {
  font-size: 0.85rem;
  color: var(--muted);
}

.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus {
  border-color: rgba(244, 185, 66, 0.55);
  box-shadow: 0 0 0 3px rgba(244, 185, 66, 0.12);
}

.bday-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.bday-row .field {
  flex: 1;
  min-width: 130px;
}

.field__lbl--sub {
  font-size: 0.8rem;
  opacity: 0.9;
}

.acc-err {
  margin: 0 0 12px;
}

.input--area {
  resize: vertical;
  min-height: 96px;
}

.btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), #e89a2a);
  color: #1a1208;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn--primary:hover {
  filter: brightness(1.05);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.btn--ghost:hover {
  background: var(--paper2);
}

.btn--glass {
  background: var(--paper);
  color: var(--text);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.btn--glass:hover {
  background: var(--paper2);
}

.btn--file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
}

.home {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 20px 20px 120px;
  max-width: 720px;
  margin: 0 auto;
}

.diary-corner {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  pointer-events: none;
}

.diary-corner .hero__diary,
.diary-corner .hero__diary-lbl {
  pointer-events: auto;
}

.chat-dock {
  position: fixed;
  left: max(10px, env(safe-area-inset-left));
  top: 50%;
  transform: translateY(-50%);
  z-index: 26;
  pointer-events: none;
}

.chat-dock__btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 10px 16px;
  margin: 0;
  border: none;
  border-radius: 0 18px 18px 0;
  cursor: pointer;
  pointer-events: auto;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  background: linear-gradient(
    165deg,
    rgba(61, 214, 198, 0.22),
    rgba(244, 185, 66, 0.12)
  );
  border: 1px solid rgba(255, 252, 248, 0.2);
  border-left: none;
  box-shadow:
    4px 8px 28px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
}

.chat-dock__btn:hover {
  transform: translateX(2px);
  box-shadow:
    6px 12px 32px rgba(0, 0, 0, 0.42),
    0 0 24px rgba(61, 214, 198, 0.15);
}

.chat-dock__btn:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 3px;
}

.chat-dock__glow {
  position: absolute;
  inset: -2px -4px -2px 0;
  border-radius: 0 20px 20px 0;
  background: radial-gradient(ellipse at 0% 50%, rgba(61, 214, 198, 0.35), transparent 65%);
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}

.chat-dock__mark {
  position: relative;
  z-index: 1;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent2), var(--accent));
  box-shadow: 0 4px 14px rgba(61, 214, 198, 0.4);
}

.chat-dock__lbl {
  position: relative;
  z-index: 1;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  line-height: 1;
}

.chat-shell {
  position: fixed;
  inset: 0;
  z-index: 42;
  pointer-events: none;
}

.chat-shell:not([hidden]) {
  pointer-events: auto;
}

.chat-shell__backdrop {
  display: none;
}

.chat-panel {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  min-height: 100dvh;
  margin: 0;
  border-radius: 0;
  padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  box-shadow: none;
  transform: none;
}

.chat-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.chat-panel__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.chat-panel__x {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 0.82rem;
}

.chat-panel__hint {
  margin: 0 0 12px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 12px;
  -webkit-overflow-scrolling: touch;
}

.chat-empty {
  margin: 8px 4px 4px;
  padding: 12px 14px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
  border-radius: 12px;
  background: rgba(8, 10, 14, 0.35);
  border: 1px dashed rgba(255, 252, 248, 0.12);
}

.chat-bubble {
  max-width: min(92%, 720px);
  padding: 10px 12px;
  border-radius: 14px 14px 14px 4px;
  background: rgba(255, 252, 248, 0.08);
  border: 1px solid rgba(255, 252, 248, 0.1);
  font-size: 0.9rem;
  line-height: 1.4;
  word-break: break-word;
}

.chat-bubble--me {
  position: relative;
  align-self: flex-end;
  padding-right: 34px;
  border-radius: 14px 14px 4px 14px;
  background: linear-gradient(
    145deg,
    rgba(61, 214, 198, 0.2),
    rgba(244, 185, 66, 0.1)
  );
  border-color: rgba(61, 214, 198, 0.25);
}

.chat-bubble--stacked {
  margin-top: -6px;
  border-top-left-radius: 6px;
}

.chat-bubble__del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
  background: rgba(12, 15, 20, 0.35);
  opacity: 0.75;
  transition: opacity 0.15s, background 0.15s;
}

.chat-bubble__del:hover {
  opacity: 1;
  background: rgba(190, 18, 60, 0.45);
}

.chat-bubble__del:focus {
  outline: none;
}

.chat-bubble__del:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 1px;
}

.chat-bubble__who {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent2);
  margin-bottom: 4px;
  opacity: 0.95;
}

.chat-bubble__text {
  white-space: pre-wrap;
}

.chat-bubble__time {
  display: block;
  margin-top: 6px;
  font-size: 0.65rem;
  color: var(--muted);
  opacity: 0.85;
}

.chat-compose {
  display: flex;
  gap: 8px;
  align-items: stretch;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.chat-input {
  flex: 1;
  min-width: 0;
}

.chat-shell .chat-compose .btn {
  flex-shrink: 0;
  padding: 10px 14px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.topbar__spacer {
  flex: 1;
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
}

.hero {
  display: flex;
  flex-direction: column;
  padding: 28px 24px 26px;
  min-height: min(72vh, 560px);
}

.hero__top {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero__avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  margin-bottom: 16px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(145deg, var(--paper2), transparent);
  background-size: cover;
  background-position: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.hero__avatar:empty {
  background-image: radial-gradient(circle at 30% 30%, var(--accent2), transparent 55%),
    radial-gradient(circle at 70% 70%, var(--accent), transparent 50%);
}

.hero__greet {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
}

.hero__meta {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero__bio {
  margin: 0;
  color: var(--text);
  opacity: 0.92;
  white-space: pre-wrap;
}

.hero__diary {
  display: block;
  margin: 0;
  padding: 6px 10px;
  border: none;
  background: transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.hero__diary:hover {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.hero__diary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.hero__diary:active {
  transform: scale(0.97);
}

.hero__diary img {
  display: block;
  width: auto;
  max-width: min(140px, 38vw);
  height: auto;
  max-height: 168px;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.55));
}

.hero__diary-lbl {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.overlay--books {
  z-index: 32;
  padding: 0;
  place-items: stretch;
  justify-items: stretch;
  align-items: stretch;
}

.books-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.books-panel__head .overlay__title {
  margin: 0;
}

.books-panel__close {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 0.85rem;
}

.books-row {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: flex-end;
  gap: clamp(14px, 2.8vw, 28px);
  padding: 16px 16px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 16px;
}

.book-item {
  flex: 0 0 auto;
  width: clamp(124px, min(38vw, 48vh), 288px);
  margin: 0;
  scroll-snap-align: start;
  text-align: center;
}

.book-item__frame {
  display: block;
  width: 100%;
  aspect-ratio: 140 / 198;
  border-radius: 10px;
  background: rgba(8, 10, 14, 0.65);
  overflow: hidden;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.12);
}

.book-item__frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.book-item--reader {
  position: relative;
  cursor: pointer;
}

.book-item__bookmark {
  position: absolute;
  top: 12%;
  right: -5px;
  width: clamp(14px, 5.5%, 22px);
  height: clamp(42px, 28%, 64px);
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0 5px 5px 0;
  cursor: pointer;
  z-index: 3;
  box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.book-item__bookmark:hover {
  transform: translateX(4px);
  filter: brightness(1.1);
}

.book-item__bookmark:focus {
  outline: none;
}

.book-item__bookmark:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
}

.book-item__bookmark--amber {
  background: linear-gradient(180deg, #f4d06f, #c9951c);
}

.book-item__bookmark--teal {
  background: linear-gradient(180deg, #5eead4, #2a9d8f);
}

.book-item__bookmark--violet {
  background: linear-gradient(180deg, #c4b5fd, #7c3aed);
}

.book-item__bookmark--rose {
  background: linear-gradient(180deg, #fda4af, #e11d48);
}

.book-item__bookmark--sky {
  background: linear-gradient(180deg, #7dd3fc, #0369a1);
}

.book-item__bookmark--lime {
  background: linear-gradient(180deg, #d9f99d, #4d7c0f);
}

.book-item--reader:hover .book-item__frame {
  box-shadow:
    0 6px 22px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(244, 185, 66, 0.35);
}

.book-item--reader:focus {
  outline: none;
}

.book-item--reader:focus-visible .book-item__frame {
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.4),
    0 0 0 2px var(--accent);
}

.book-item figcaption {
  margin-top: 10px;
  font-size: clamp(0.72rem, 2.1vw, 0.88rem);
  line-height: 1.25;
  color: var(--muted);
  max-width: 13em;
  margin-left: auto;
  margin-right: auto;
}

.book-item__wip {
  display: block;
  margin-top: 5px;
  font-size: 0.88em;
  font-style: italic;
  line-height: 1.2;
  color: var(--muted);
  opacity: 0.88;
}

@media (max-width: 520px) {
  .book-item figcaption {
    font-size: clamp(0.68rem, 3.2vw, 0.8rem);
    max-width: 11em;
  }
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
}

.overlay--liter {
  z-index: 45;
  padding: 12px 14px;
  align-content: center;
}

.liter-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
}

.liter-panel__title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
}

.liter-panel__hint {
  margin: 0 0 8px;
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.liter-panel__err {
  margin: 0 0 8px;
}

.liter-scroll {
  flex: 1;
  min-height: 200px;
  max-height: min(78vh, 880px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 8px;
  border-radius: 10px;
  background: rgba(8, 10, 14, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 252, 248, 0.08);
}

.liter-page {
  margin: 0 0 14px;
  padding: 0;
}

.liter-page:last-child {
  margin-bottom: 4px;
}

.liter-page img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.liter-pdf {
  display: block;
  width: 100%;
  min-height: min(72vh, 820px);
  height: min(78vh, 860px);
  border: 0;
  border-radius: 8px;
  background: #12151c;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 12, 0.55);
  backdrop-filter: blur(6px);
}

.overlay__panel {
  position: relative;
  width: min(100%, 440px);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 24px 22px 20px;
}

.overlay__panel.books-panel {
  width: 100%;
  max-width: none;
  max-height: none;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  box-sizing: border-box;
  padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

.overlay__panel.liter-panel {
  width: min(100%, 720px);
  max-width: 720px;
  max-height: calc(100vh - 24px);
  overflow: hidden;
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
}

.overlay__title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.overlay__sub {
  margin: 0 0 18px;
  font-size: 0.88rem;
  color: var(--muted);
}

.acc-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.acc-preview__img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.overlay__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  flex-wrap: wrap;
}

.overlay .field + .field {
  margin-top: 14px;
}

.admin-entry {
  font-size: 0.82rem;
  padding: 8px 12px;
}

.btn--hw {
  font-size: 0.78rem;
  padding: 8px 10px;
  line-height: 1.2;
}

@media (max-width: 520px) {
  .btn--hw {
    font-size: 0.68rem;
    padding: 8px 7px;
  }
}

.btn--sched {
  font-size: 0.78rem;
  padding: 8px 10px;
  line-height: 1.2;
}

@media (max-width: 520px) {
  .btn--sched {
    font-size: 0.68rem;
    padding: 8px 7px;
  }
}

.overlay--sched {
  z-index: 36;
  padding: 0;
  place-items: stretch;
}

.overlay--sched .sched-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0;
  background:
    radial-gradient(ellipse 120% 70% at 50% -25%, rgba(244, 185, 66, 0.14), transparent 55%),
    radial-gradient(ellipse 55% 45% at 0% 45%, rgba(61, 214, 198, 0.1), transparent 50%),
    radial-gradient(ellipse 45% 50% at 100% 75%, rgba(140, 110, 255, 0.08), transparent 45%),
    linear-gradient(168deg, #151d28 0%, #0e151d 40%, #080b10 100%);
  box-shadow: inset 0 1px 0 rgba(255, 252, 248, 0.05);
}

.overlay--sched .sched-sheet::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent2), var(--accent) 45%, #d4a84b 78%, var(--accent2));
  opacity: 0.92;
  pointer-events: none;
  z-index: 2;
}

.overlay--sched .sched-sheet::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.09;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.overlay--sched .sched-topbar,
.overlay--sched .sched-mount {
  position: relative;
  z-index: 1;
}

.sched-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  padding: max(clamp(16px, 3.2vw, 24px), env(safe-area-inset-top)) clamp(14px, 3vw, 28px) 14px
    max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-left));
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 252, 248, 0.07);
  background: linear-gradient(180deg, rgba(255, 252, 248, 0.04) 0%, transparent 100%);
}

.sched-topbar__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.08rem, 2.5vw, 1.42rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(105deg, var(--text) 0%, rgba(242, 239, 232, 0.88) 50%, var(--accent) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@supports not (background-clip: text) {
  .sched-topbar__title {
    color: var(--text);
    background: none;
  }
}

.sched-topbar__range {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
  max-width: 48ch;
  padding-left: 0.55rem;
  border-left: 2px solid rgba(61, 214, 198, 0.45);
}

.sched-topbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.sched-mount {
  flex: 1 1 auto;
  min-height: min(48vh, 480px);
  padding: 0 clamp(12px, 2.8vw, 28px) max(20px, env(safe-area-inset-bottom));
  overflow: visible;
}

.sched-layout {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.sched-banner {
  flex-shrink: 0;
  margin: 16px 0 0;
  padding: 16px clamp(12px, 2.2vw, 20px) 18px;
  border-radius: var(--radius);
  background: rgba(8, 12, 20, 0.55);
  border: 1px solid rgba(255, 252, 248, 0.1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 252, 248, 0.06);
}

.sched-banner__row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px 10px;
  text-align: center;
  align-items: start;
}

.sched-banner__row--dow {
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 252, 248, 0.08);
}

.sched-banner__cell--dow {
  min-width: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.64rem, 1.4vw, 0.84rem);
  line-height: 1.25;
  color: rgba(242, 239, 232, 0.95);
  padding: 6px 4px;
  border-radius: 8px;
  background: rgba(255, 252, 248, 0.03);
}

.sched-banner__dow-short {
  display: none;
}

@media (max-width: 720px) {
  .sched-banner__dow-full {
    display: none;
  }
  .sched-banner__dow-short {
    display: inline;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(242, 239, 232, 0.75);
  }
}

.sched-banner__row--nums {
  gap: 8px 10px;
}

.sched-banner__cell--num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  margin: 0 auto;
  width: 100%;
  max-width: 3rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.2rem, 3vw, 1.68rem);
  line-height: 1;
  color: var(--accent);
  background: radial-gradient(
    circle at 30% 25%,
    rgba(244, 185, 66, 0.22),
    rgba(8, 12, 20, 0.65) 70%
  );
  border-radius: 999px;
  border: 1px solid rgba(244, 185, 66, 0.35);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.2) inset,
    0 6px 16px rgba(0, 0, 0, 0.25);
}

.sched-body {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  margin-top: 18px;
  min-width: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255, 252, 248, 0.1);
  background: rgba(5, 9, 15, 0.5);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

@media (max-width: 960px) {
  .sched-body {
    grid-template-columns: repeat(7, minmax(108px, 1fr));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(244, 185, 66, 0.35) transparent;
  }

  .sched-body::-webkit-scrollbar {
    height: 6px;
  }

  .sched-body::-webkit-scrollbar-thumb {
    background: rgba(244, 185, 66, 0.35);
    border-radius: 99px;
  }
}

.sched-lesson-col {
  min-width: 0;
  min-height: 128px;
  padding: 14px 11px 18px;
  border-right: 1px solid rgba(255, 252, 248, 0.06);
  position: relative;
}

.sched-lesson-col::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  opacity: 0.35;
  pointer-events: none;
}

.sched-lesson-col:nth-child(7n + 1)::before {
  opacity: 0.42;
  background: linear-gradient(90deg, var(--accent2), rgba(61, 214, 198, 0.3));
}

.sched-lesson-col:nth-child(7n + 4)::before {
  opacity: 0.42;
  background: linear-gradient(90deg, var(--accent), rgba(244, 185, 66, 0.25));
}

.sched-lesson-col:nth-child(7n + 7)::before {
  opacity: 0.38;
  background: linear-gradient(90deg, rgba(140, 110, 255, 0.6), var(--accent2));
}

.sched-lesson-col:nth-child(odd) {
  background: rgba(255, 252, 248, 0.02);
}

.sched-lesson-col:nth-child(even) {
  background: rgba(61, 214, 198, 0.03);
}

.sched-lesson-col:last-child {
  border-right: none;
}

.sched-lesson-col__list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.83rem;
  line-height: 1.5;
  color: rgba(242, 239, 232, 0.94);
}

.sched-lesson-col__list li {
  position: relative;
  margin-bottom: 9px;
  padding-left: 0.95rem;
}

.sched-lesson-col__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  box-shadow: 0 0 10px rgba(244, 185, 66, 0.25);
}

.sched-lesson-col__list li:last-child {
  margin-bottom: 0;
}

.sched-lesson-col__empty {
  padding-left: 0;
  color: var(--muted);
  font-style: italic;
}

.sched-lesson-col__empty::before {
  display: none;
}

.sched-edit-note {
  margin: 12px 0 0;
  padding: 10px 14px;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 72ch;
  border-radius: 10px;
  background: rgba(61, 214, 198, 0.06);
  border: 1px solid rgba(61, 214, 198, 0.15);
}

.sched-body--edit .sched-lesson-col--edit {
  min-height: 210px;
  padding: 12px 9px 14px;
}

.sched-ta {
  width: 100%;
  min-height: 148px;
  height: 100%;
  resize: vertical;
  font-family: inherit;
  font-size: 0.81rem;
  line-height: 1.45;
  box-sizing: border-box;
  border-radius: 10px;
  padding: 10px 11px;
  background: rgba(4, 8, 14, 0.65);
  border: 1px solid rgba(255, 252, 248, 0.1);
  color: var(--text);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sched-ta:hover {
  border-color: rgba(244, 185, 66, 0.22);
}

.sched-ta:focus {
  outline: none;
  border-color: rgba(244, 185, 66, 0.55);
  box-shadow:
    inset 0 2px 12px rgba(0, 0, 0, 0.2),
    0 0 0 2px rgba(61, 214, 198, 0.2);
}

.overlay--hw {
  z-index: 38;
  padding: 0;
  place-items: stretch;
}

.overlay--hw .hw-panel {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  min-height: 100dvh;
  max-height: none;
  height: auto;
  border-radius: 0;
  padding: clamp(16px, 3.5vw, 28px) clamp(16px, 4vw, 32px)
    max(16px, env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.overlay--hw .overlay__title {
  flex-shrink: 0;
}

.overlay--hw .overlay__actions {
  margin-top: auto;
  padding-top: 20px;
  flex-shrink: 0;
}

.hw-hint {
  margin-top: 0;
  flex-shrink: 0;
}

.hw-read {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: min(40vh, 320px);
  margin: 10px 0 16px;
  padding: clamp(16px, 3vw, 22px) clamp(14px, 3vw, 20px);
  border-radius: 14px;
  background: rgba(8, 10, 14, 0.45);
  border: 1px solid rgba(255, 252, 248, 0.08);
}

.hw-edit {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.hw-line {
  font-size: clamp(0.95rem, 2.2vw, 1.08rem);
  line-height: 1.45;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 4px;
}

.hw-line__subj {
  color: #fff;
  font-weight: 700;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.12);
}

.hw-line__sep {
  color: var(--muted);
  font-weight: 600;
  user-select: none;
}

.hw-line__task {
  color: var(--text);
  flex: 1;
  min-width: min(100%, 12em);
}

.hw-days {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.hw-day-tab {
  font-family: inherit;
  cursor: pointer;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  -webkit-appearance: none;
  appearance: none;
}

.hw-day-tab:hover {
  filter: brightness(1.12);
}

.hw-day-tab.is-on {
  background: rgba(244, 185, 66, 0.22);
  border-color: rgba(244, 185, 66, 0.45);
  color: var(--text);
}

.hw-edit-rows {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 8px;
  padding-right: 4px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.hw-edit-block .field + .field {
  margin-top: 8px;
}

.hw-task-ta {
  resize: vertical;
  min-height: 52px;
  font-family: inherit;
}

.overlay--admin {
  z-index: 50;
}

.overlay__panel.admin-panel {
  width: min(100%, 520px);
  max-width: 520px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 20px 20px 16px;
}

.admin-panel__note code {
  font-size: 0.82em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.admin-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
}

.admin-row__title {
  flex: 1;
  min-width: 140px;
  font-size: 0.92rem;
}

.admin-row__meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.admin-row__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-row__btns .btn {
  padding: 6px 10px;
  font-size: 0.78rem;
}

.admin-cover-row {
  margin-top: 10px;
}

.admin-cover-pick {
  font-size: 0.85rem;
}

.admin-cover-preview {
  display: block;
  max-width: 100%;
  max-height: 140px;
  width: auto;
  height: auto;
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  object-fit: contain;
  background: rgba(0, 0, 0, 0.2);
}

.admin-form__h {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 700;
}

.admin-form__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.admin-panel__foot {
  margin-top: 18px;
}

.admin-panel__err {
  margin-top: 10px;
}

.topbar__beta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge--btn {
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.badge--btn:hover {
  filter: brightness(1.12);
}

.badge--exit {
  background: rgba(140, 40, 40, 0.4);
  border-color: rgba(255, 140, 120, 0.35);
  color: #ffe8e4;
}

.badge--won {
  display: inline-block;
  border-color: rgba(244, 185, 66, 0.5);
  box-shadow: 0 0 18px rgba(244, 185, 66, 0.22);
}

body.beta-survived .badge--won {
  animation: betaGlow 3.5s ease-in-out infinite;
}

@keyframes betaGlow {
  0%,
  100% {
    box-shadow: 0 0 14px rgba(244, 185, 66, 0.2);
  }
  50% {
    box-shadow: 0 0 32px rgba(244, 185, 66, 0.5);
  }
}

.tube-plug {
  margin-top: 20px;
  align-self: flex-start;
  padding: 14px 26px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  color: #2e1a08;
  border: 3px solid #4a3018;
  border-radius: 12px;
  cursor: pointer;
  background: linear-gradient(180deg, #c9a064 0%, #8f6638 48%, #5c3d22 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 230, 190, 0.4),
    0 12px 28px rgba(0, 0, 0, 0.5);
}

.tube-plug:hover {
  filter: brightness(1.05);
}

.tube-plug:active {
  transform: translateY(2px);
}

.brawl-darks-btn {
  margin-top: 12px;
  align-self: flex-start;
  padding: 12px 22px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e8e4f0;
  border: 2px solid rgba(120, 80, 200, 0.65);
  border-radius: 10px;
  cursor: pointer;
  background: linear-gradient(165deg, #1e1430 0%, #120a1c 55%, #0a0610 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 28px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(100, 60, 180, 0.2);
}

.brawl-darks-btn:hover {
  filter: brightness(1.08);
  border-color: rgba(160, 120, 240, 0.75);
}

.brawl-darks-btn:active {
  transform: translateY(2px);
}

.brawl-shell {
  --brawl-zoom: 1.36;
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  flex-direction: column;
  background: #000;
  box-sizing: border-box;
  padding: 0;
  overflow: hidden;
}

@media (max-width: 520px) {
  .brawl-shell {
    --brawl-zoom: 1.22;
  }
}

@media (min-width: 1100px) {
  .brawl-shell {
    --brawl-zoom: 1.48;
  }
}

.brawl-shell__viewport {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.brawl-shell__frame {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  max-width: none;
  border: 0;
  display: block;
  transform: translate(-50%, -50%) scale(var(--brawl-zoom));
  transform-origin: center center;
  will-change: transform;
}

.brawl-shell__close {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 2;
  font-weight: 700;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9);
  background: rgba(8, 10, 14, 0.65);
  border: 1px solid rgba(255, 252, 248, 0.14);
  backdrop-filter: blur(8px);
}

.brawl-shell__tablink {
  position: absolute;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent2);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.85);
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(8, 10, 14, 0.55);
}

.brawl-shell__tablink:hover {
  color: var(--accent);
}

.tube-game {
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  background:
    radial-gradient(ellipse 120% 80% at 50% 100%, rgba(35, 22, 12, 0.95) 0%, transparent 55%),
    radial-gradient(ellipse 80% 60% at 20% 30%, rgba(18, 40, 55, 0.35) 0%, transparent 50%),
    radial-gradient(ellipse 70% 50% at 85% 25%, rgba(30, 18, 45, 0.4) 0%, transparent 45%),
    linear-gradient(168deg, #030508 0%, #0a0604 40%, #050308 100%);
}

.tube-game__vignette {
  position: absolute;
  inset: 0;
  z-index: 11;
  pointer-events: none;
  background: radial-gradient(ellipse 52% 48% at 50% 44%, transparent 0%, transparent 28%, rgba(0, 0, 0, 0.45) 72%, rgba(0, 0, 0, 0.88) 100%);
}

.tube-game__atmos {
  position: absolute;
  inset: -5%;
  z-index: 9;
  pointer-events: none;
  opacity: 0.55;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 180, 90, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 70% 80%, rgba(80, 140, 255, 0.05) 0%, transparent 35%);
  animation: tubeAtmosDrift 14s ease-in-out infinite;
}

@keyframes tubeAtmosDrift {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.5;
  }
  50% {
    transform: translate(2%, -1%) scale(1.03);
    opacity: 0.65;
  }
}

.tube-game__grain {
  position: absolute;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.12;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: tubeGrainFlicker 0.25s steps(2) infinite;
}

@keyframes tubeGrainFlicker {
  0% {
    opacity: 0.1;
  }
  100% {
    opacity: 0.14;
  }
}

.tube-game__streak {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 42;
  margin: 0;
  padding: 8px 14px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #ffe8c8;
  text-shadow: 0 0 18px rgba(255, 160, 80, 0.5);
  background: linear-gradient(135deg, rgba(60, 35, 18, 0.92) 0%, rgba(25, 14, 8, 0.94) 100%);
  border: 1px solid rgba(200, 140, 80, 0.45);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 220, 180, 0.12);
}

.tube-game__clock {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  font-family: "JetBrains Mono", ui-monospace, "Consolas", monospace;
  font-size: clamp(1.45rem, 5.2vw, 2.35rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #fff0c8;
  text-shadow:
    0 0 20px rgba(255, 200, 100, 0.45),
    0 0 40px rgba(255, 140, 60, 0.2);
  padding: 12px 26px 14px;
  background: linear-gradient(165deg, rgba(28, 18, 10, 0.96) 0%, rgba(12, 8, 6, 0.98) 100%);
  border: 2px solid rgba(180, 120, 60, 0.55);
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 12px 40px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 220, 160, 0.15);
}

.tube-game__clock-ring {
  display: block;
  position: absolute;
  inset: -4px;
  border-radius: 16px;
  border: 1px solid rgba(255, 200, 120, 0.12);
  pointer-events: none;
  animation: tubeClockPulse 2.8s ease-in-out infinite;
}

@keyframes tubeClockPulse {
  0%,
  100% {
    opacity: 0.5;
    box-shadow: 0 0 0 0 rgba(255, 180, 100, 0);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 24px 2px rgba(255, 160, 80, 0.15);
  }
}

.tube-game__clock-hint {
  display: block;
  font-size: 0.34em;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(200, 160, 120, 0.65);
  text-align: center;
  margin-top: 6px;
  font-weight: 600;
}

.tube-game--tense {
  animation: tubeTenseHue 2.4s ease-in-out infinite;
}

@keyframes tubeTenseHue {
  0%,
  100% {
    filter: saturate(1) brightness(1);
  }
  50% {
    filter: saturate(1.15) brightness(0.97);
  }
}

.tube-game--tense .tube-game__vignette {
  background: radial-gradient(ellipse 52% 48% at 50% 44%, transparent 0%, transparent 22%, rgba(40, 0, 0, 0.25) 55%, rgba(0, 0, 0, 0.9) 100%);
}

.tube-game--shake {
  animation: tubeShake 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes tubeShake {
  0% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-6px, 3px) rotate(-0.4deg);
  }
  40% {
    transform: translate(8px, -4px) rotate(0.5deg);
  }
  60% {
    transform: translate(-5px, 2px);
  }
  80% {
    transform: translate(4px, -2px);
  }
  100% {
    transform: translate(0, 0);
  }
}

.tube-game__persp {
  position: absolute;
  inset: 0;
  perspective: 820px;
  perspective-origin: 50% 40%;
  overflow: hidden;
}

.tube-fp {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 175vmin;
  height: 175vmin;
  margin-left: -87.5vmin;
  margin-top: -87.5vmin;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
  transition: transform 0.32s cubic-bezier(0.22, 1.1, 0.36, 1);
}

.tube-fp__inner {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    repeating-linear-gradient(
      92deg,
      transparent 0px,
      transparent 8px,
      rgba(0, 0, 0, 0.04) 8px,
      rgba(0, 0, 0, 0.04) 9px
    ),
    repeating-linear-gradient(
      -88deg,
      rgba(55, 38, 22, 0.12) 0px,
      rgba(35, 24, 14, 0.18) 2px,
      rgba(70, 48, 28, 0.08) 5px
    ),
    linear-gradient(90deg, transparent 0%, transparent 5.5%, rgba(62, 42, 24, 0.98) 5.5%, rgba(48, 32, 18, 0.99) 9%, transparent 9%),
    linear-gradient(90deg, transparent 91%, rgba(48, 32, 18, 0.99) 91%, rgba(62, 42, 24, 0.98) 94.5%, transparent 94.5%),
    radial-gradient(ellipse 54% 60% at 50% 48%, #000000 0%, #050302 18%, #140d08 42%, #2a1c10 68%, #3d2815 88%, #4a3018 100%);
  box-shadow:
    inset 0 0 160px rgba(0, 0, 0, 0.92),
    inset 0 -30px 80px rgba(255, 160, 80, 0.04);
  animation: tubeWoodBreath 5.5s ease-in-out infinite;
}

@keyframes tubeWoodBreath {
  0%,
  100% {
    filter: brightness(0.98) contrast(1.02);
  }
  50% {
    filter: brightness(1.04) contrast(1.05);
  }
}

.tube-fp__rings {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  pointer-events: none;
  background: repeating-radial-gradient(
    circle at 50% 50%,
    transparent 0,
    transparent 5.5vmin,
    rgba(0, 0, 0, 0.28) 5.6vmin,
    rgba(90, 62, 38, 0.15) 5.8vmin,
    transparent 6.1vmin
  );
  mix-blend-mode: multiply;
  opacity: 0.85;
  animation: tubeRingsIn 26s linear infinite;
}

@keyframes tubeRingsIn {
  from {
    transform: scale(0.92);
    opacity: 0.75;
  }
  to {
    transform: scale(1.06);
    opacity: 0.92;
  }
}

.tube-game__metal {
  position: absolute;
  z-index: 24;
  pointer-events: none;
  transition: transform 0.42s cubic-bezier(0.25, 1.15, 0.32, 1.02), opacity 0.25s, filter 0.3s;
  opacity: 0.96;
  filter: drop-shadow(0 0 12px rgba(0, 0, 0, 0.5));
}

.tube-game__metal--left {
  left: 0;
  top: 0;
  bottom: 0;
  width: 32%;
  max-width: 220px;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 18px, rgba(0, 0, 0, 0.12) 18px, rgba(0, 0, 0, 0.12) 19px),
    linear-gradient(90deg, #1e2028 0%, #4a4e5c 28%, #6a6e7c 48%, #4d515c 72%, #2a2c34 100%);
  box-shadow:
    inset -8px 0 28px rgba(0, 0, 0, 0.65),
    inset 0 0 40px rgba(255, 255, 255, 0.04),
    6px 0 32px rgba(0, 0, 0, 0.55);
  border-right: 5px solid #0c0e14;
  transform: translateX(-108%);
}

.tube-game__metal--left.is-shut {
  transform: translateX(0);
  filter: drop-shadow(0 0 20px rgba(100, 200, 255, 0.08));
}

.tube-game__metal--right {
  right: 0;
  top: 0;
  bottom: 0;
  width: 32%;
  max-width: 220px;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 18px, rgba(0, 0, 0, 0.12) 18px, rgba(0, 0, 0, 0.12) 19px),
    linear-gradient(270deg, #1e2028 0%, #4a4e5c 28%, #6a6e7c 48%, #4d515c 72%, #2a2c34 100%);
  box-shadow:
    inset 8px 0 28px rgba(0, 0, 0, 0.65),
    inset 0 0 40px rgba(255, 255, 255, 0.04),
    -6px 0 32px rgba(0, 0, 0, 0.55);
  border-left: 5px solid #0c0e14;
  transform: translateX(108%);
}

.tube-game__metal--right.is-shut {
  transform: translateX(0);
  filter: drop-shadow(0 0 20px rgba(100, 200, 255, 0.08));
}

.tube-game__metal--back {
  left: 0;
  right: 0;
  bottom: 0;
  height: 40%;
  max-height: 300px;
  background:
    repeating-linear-gradient(90deg, transparent, transparent 22px, rgba(0, 0, 0, 0.1) 22px, rgba(0, 0, 0, 0.1) 23px),
    linear-gradient(0deg, #1c1e24 0%, #454952 38%, #5a5e68 55%, #3a3c44 100%);
  box-shadow:
    inset 0 10px 32px rgba(0, 0, 0, 0.55),
    inset 0 -4px 24px rgba(255, 255, 255, 0.03),
    0 -8px 36px rgba(0, 0, 0, 0.5);
  border-top: 5px solid #0c0e14;
  transform: translateY(108%);
}

.tube-game__metal--back.is-shut {
  transform: translateY(0);
  filter: drop-shadow(0 -8px 24px rgba(100, 200, 255, 0.08));
}

.tube-game__flash {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.92);
}

.tube-game__chub {
  position: absolute;
  z-index: 22;
  max-width: min(54vw, 320px);
  max-height: 64vh;
  width: auto;
  height: auto;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s linear, transform 0.2s ease-out;
  filter: drop-shadow(0 0 28px rgba(200, 20, 40, 0.65)) drop-shadow(0 0 60px rgba(80, 0, 0, 0.45));
}

.tube-game__chub.is-on {
  opacity: 1;
  visibility: visible;
  animation: tubeChubLurk 0.85s ease-in-out infinite;
}

@keyframes tubeChubLurk {
  0%,
  100% {
    filter: drop-shadow(0 0 28px rgba(200, 20, 40, 0.65)) drop-shadow(0 0 50px rgba(80, 0, 0, 0.4));
  }
  50% {
    filter: drop-shadow(0 0 40px rgba(255, 50, 70, 0.85)) drop-shadow(0 0 72px rgba(120, 0, 20, 0.55));
  }
}

.tube-game__chub--left {
  left: -1%;
  bottom: 18%;
  right: auto;
  transform: none;
}

.tube-game__chub--right {
  right: -1%;
  left: auto;
  bottom: 18%;
}

.tube-game__chub--right.is-on {
  transform: scaleX(-1);
}

.tube-game__chub--back {
  left: 50%;
  bottom: 8%;
  right: auto;
  transform: translateX(-50%);
  max-width: min(64vw, 360px);
}

.tube-game__chub--back.is-on {
  transform: translateX(-50%);
}

.tube-game__hand {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(120px, calc(env(safe-area-inset-bottom) + 96px));
  z-index: 35;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  pointer-events: none;
  filter: drop-shadow(0 0 14px rgba(255, 220, 140, 0.55));
}

.tube-game__flash-ico {
  display: inline-block;
  animation: tubeFlashBob 2.2s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(255, 230, 160, 0.7));
}

@keyframes tubeFlashBob {
  0%,
  100% {
    transform: rotate(-6deg) translateY(0);
  }
  50% {
    transform: rotate(4deg) translateY(-4px);
  }
}

.tube-game__hint {
  position: absolute;
  left: 50%;
  bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));
  transform: translateX(-50%);
  z-index: 36;
  margin: 0;
  max-width: min(92vw, 440px);
  text-align: center;
  font-size: 0.78rem;
  color: rgba(210, 185, 155, 0.58);
  line-height: 1.5;
  pointer-events: none;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.85);
}

.tube-game__hint strong {
  color: rgba(255, 215, 170, 0.85);
  font-weight: 700;
}

.tube-game__doors {
  position: absolute;
  inset: 0;
  z-index: 38;
  pointer-events: none;
}

.tube-game__doors .tube-iron {
  pointer-events: auto;
  position: absolute;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid rgba(140, 150, 165, 0.9);
  background: linear-gradient(165deg, #5a6470 0%, #30343c 45%, #252830 100%);
  color: #f2f6fc;
  cursor: pointer;
  max-width: 158px;
  line-height: 1.25;
  box-shadow:
    0 6px 22px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition:
    transform 0.12s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.tube-game__doors .tube-iron:hover {
  transform: scale(1.03);
  border-color: rgba(180, 200, 220, 0.95);
}

.tube-game__doors .tube-iron:active {
  transform: scale(0.97);
}

.tube-game__doors .tube-iron.is-shut {
  background: linear-gradient(165deg, #34b86a 0%, #1a7a42 50%, #0d4a28 100%);
  border-color: #6ef0a0;
  color: #f0fff6;
  box-shadow:
    0 0 28px rgba(60, 220, 120, 0.35),
    0 6px 22px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.tube-game__doors .tube-iron.tube-iron--hot {
  animation: tubeIronHot 0.55s ease-in-out infinite;
  border-color: #ff8060;
  box-shadow:
    0 0 26px rgba(255, 80, 60, 0.55),
    0 6px 22px rgba(0, 0, 0, 0.55),
    inset 0 0 20px rgba(255, 100, 80, 0.15);
}

@keyframes tubeIronHot {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.04);
    filter: brightness(1.12);
  }
}

#tubeDoorL {
  left: max(10px, env(safe-area-inset-left));
  top: 50%;
  transform: translateY(-50%);
}

#tubeDoorR {
  right: max(10px, env(safe-area-inset-right));
  left: auto;
  top: 50%;
  transform: translateY(-50%);
}

#tubeDoorB {
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
}

.tube-game__skrimer {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: #000;
  display: grid;
  place-items: center;
}

.tube-game__skrimer img {
  width: min(100vw, 100vh);
  height: min(100vw, 100vh);
  object-fit: contain;
  animation: tubeSkr 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
  filter: contrast(1.08) saturate(1.1);
}

@keyframes tubeSkr {
  from {
    transform: scale(0.4) rotate(-2deg);
    opacity: 0;
    filter: blur(4px);
  }
  40% {
    opacity: 1;
    filter: blur(0);
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

.tube-game__end {
  position: absolute;
  inset: 0;
  z-index: 260;
  background: rgba(4, 2, 8, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px 22px;
  text-align: center;
  backdrop-filter: blur(8px);
}

.tube-game__end--win {
  background:
    radial-gradient(ellipse 80% 60% at 50% 30%, rgba(255, 200, 100, 0.18) 0%, transparent 55%),
    rgba(8, 12, 20, 0.94);
}

.tube-game__end--lose {
  background:
    radial-gradient(ellipse 70% 50% at 50% 70%, rgba(40, 60, 120, 0.2) 0%, transparent 50%),
    rgba(4, 4, 12, 0.96);
}

.tube-game__end-badge {
  margin: 0 0 4px;
  padding: 6px 18px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #1a1208;
  background: linear-gradient(90deg, #f4d998, #ffd78a, #e8b860);
  border-radius: 999px;
  box-shadow: 0 0 40px rgba(255, 200, 100, 0.45);
}

.tube-game__end-t {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 4.2vw, 1.55rem);
  font-weight: 700;
  margin: 0;
  max-width: 22rem;
  line-height: 1.25;
}

.tube-game__end--win .tube-game__end-t {
  color: #fff8f0;
  text-shadow: 0 0 40px rgba(255, 200, 120, 0.25);
}

.tube-game__end-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 22rem;
  line-height: 1.45;
}

.tube-game__end-sub--lose {
  color: rgba(180, 190, 220, 0.75);
}

.tube-game__end-streak {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(255, 200, 140, 0.9);
}

[hidden] {
  display: none !important;
}
