@import url("https://fonts.googleapis.com/css2?family=Caveat:wght@500;600&family=Comfortaa:wght@400;600&family=Neucha&family=Patrick+Hand&display=swap");

:root {
  --paper: #f8f6ec;
  --ink: #1c3476;
  --accent: #aa2d2d;
  --panel: #3a4558;
  --panel-dark: #2a3344;
  --panel-light: #4e5c72;
  --metal: #8a93a3;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --stick-size: min(42vw, 132px);
  --game-font: "Neucha", "Patrick Hand", cursive;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* поля ввода аккаунта — можно выделять/копировать */
input,
textarea,
[contenteditable="true"] {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #1e2430;
  font-family: var(--game-font);
  color: var(--ink);
  touch-action: manipulation;
  /* блокировка жестов зума на части браузеров */
  -ms-touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.app {
  height: 100%;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: calc(6px + var(--safe-t)) 0 0;
  gap: 0;
  max-width: 560px;
  margin: 0 auto;
  background: linear-gradient(180deg, #2a3344 0%, #1e2430 40%, #1a1f28 100%);
}

.app.is-hidden {
  display: none !important;
}


/* —— хаб (единый экран после входа) —— */
.hub-screen {
  display: none;
  height: 100%;
  height: 100dvh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

body.hub-mode .hub-screen {
  display: block;
}

body.hub-mode .hub-screen.is-hidden,
.hub-screen.is-hidden {
  display: none !important;
}

body.hub-mode {
  overflow: auto;
  background: var(--paper, #f8f6ec);
}

.hub-sheet {
  min-height: 100%;
}

.hub-screen .nb-menu-item {
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: rgba(28, 52, 118, 0.12);
}

.hub-screen .nb-menu-item:active {
  transform: scale(0.99);
}

.hub-footer {
  display: grid;
  gap: 10px;
}

.daily-quests {
  margin: 0 0 18px;
}

.daily-page .nb-content {
  padding-bottom: 28px;
}

.daily-page .daily-quests-list {
  margin-top: 4px;
}

.daily-quests-meta {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: #4664a0;
}

.daily-quests-list {
  display: grid;
  gap: 10px;
}

.daily-quest {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  background: #fffef8;
  box-shadow: 2px 2px 0 rgba(28, 52, 118, 0.1);
}

.daily-quest.is-done {
  background: #e8f3ea;
}

.daily-quest.is-claimed {
  opacity: 0.72;
  background: #f0f2f6;
}

.daily-quest-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.daily-quest-body strong {
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.2;
}

.daily-quest-desc {
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.25;
}

.daily-quest-hint {
  font-size: 0.82rem;
  color: #4664a0;
  line-height: 1.25;
}

.daily-quest-bar {
  position: relative;
  height: 6px;
  margin-top: 4px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: #eef2f8;
  overflow: hidden;
}

.daily-quest-bar i {
  display: block;
  height: 100%;
  background: #2f6fad;
}

.daily-quest.is-done .daily-quest-bar i {
  background: #287846;
}

.daily-quest-prog {
  font-size: 0.85rem;
  color: #35507a;
}

.daily-quest-claim {
  min-width: 4.6em;
  padding: 8px 10px;
  font-size: 0.95rem;
}

.daily-quest-claim:disabled {
  opacity: 0.55;
  cursor: default;
}

@media (max-width: 520px) {
  .daily-quest {
    grid-template-columns: 1fr;
  }

  .daily-quest-claim {
    width: 100%;
  }
}

.top {
  text-align: center;
  min-height: 0;
  padding: 0 8px 4px;
  color: #c8d2e4;
}

.top h1 {
  margin: 0;
  font-size: clamp(1.15rem, 4.2vw, 1.55rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.1;
  color: #e8eef8;
}

#status {
  margin: 2px 0 0;
  font-size: 0.8rem;
  opacity: 0.7;
  min-height: 1.1em;
  color: #a8b4c8;
}

.stage {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0 8px 6px;
}

#game {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  background: var(--paper);
  border: 2px solid #6a7588;
  border-radius: 6px;
  box-shadow:
    0 0 0 3px #2a3344,
    0 8px 24px rgba(0, 0, 0, 0.35);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

/* —— панель кабины —— */
.cockpit-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 6px 10px calc(6px + var(--safe-b));
  background:
    linear-gradient(180deg, #505c70 0%, var(--panel) 12%, var(--panel-dark) 100%),
    repeating-linear-gradient(
      90deg,
      transparent 0 11px,
      rgba(0, 0, 0, 0.06) 11px 12px
    );
  border-top: 2px solid #6d7a90;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.12),
    inset 0 -6px 16px rgba(0, 0, 0, 0.35);
  position: relative;
  touch-action: none;
}

.cockpit-panel::before,
.cockpit-panel::after {
  content: "";
  position: absolute;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #c0c8d4, #5a6578 60%, #2a3344);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.35);
}

.cockpit-panel::before { left: 8px; }
.cockpit-panel::after { right: 8px; }

.panel-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.panel-title {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: #9eb0cc;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

.rivet {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #d0d6e0, #6a7384);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}

.mute-btn {
  font-size: 0.95rem;
  line-height: 1;
  border: 1px solid #1a2030;
  border-radius: 8px;
  background: linear-gradient(180deg, #5a6578, #3a4558);
  color: #e8eef8;
  padding: 2px 8px;
  min-height: 26px;
  cursor: pointer;
  touch-action: manipulation;
}

.mute-btn:active {
  transform: scale(0.96);
}

.mute-btn.is-hidden,
.pause-btn.is-hidden {
  display: none !important;
}

.pause-btn {
  letter-spacing: -0.05em;
  font-size: 0.85rem;
}

.panel-gauges {
  display: none; /* экономим высоту — индикаторы убраны с панели */
}

.gauge {
  width: 40px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid #1a2030;
  background: #121820;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.6);
}

.gauge i {
  display: block;
  width: 70%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #2d8f5a, #6ddea0);
  box-shadow: 0 0 4px rgba(80, 220, 140, 0.55);
}

.gauge.mid i {
  background: linear-gradient(90deg, #8a6a20, #e0c050);
  box-shadow: 0 0 4px rgba(220, 180, 60, 0.5);
  width: 45%;
}

.gauge span {
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  color: #7a8aa0;
  line-height: 1;
}

.combat {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: center;
  justify-items: center;
  min-height: calc(var(--stick-size) + 8px);
  padding: 8px 4px 10px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.08));
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.combat.is-hidden {
  display: none;
}

/* автострельба: тот же размер панели, стик по центру, без кнопки огня */
body.auto-fire .combat {
  grid-template-columns: 1fr;
  justify-items: center;
  align-items: center;
}

body.auto-fire .combat .fire-bay {
  display: none !important;
}

body.auto-fire .stick-zone {
  margin: 0 auto;
}

.control-bay {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* подписи убраны — больше места под стик/огонь */
.bay-label {
  display: none;
}

.stick-zone {
  width: var(--stick-size);
  height: var(--stick-size);
  border-radius: 50%;
  border: 3px solid #1a2030;
  background:
    radial-gradient(circle at 40% 35%, #5a6578, #2e3646 55%, #1a2030 100%);
  box-shadow:
    inset 0 3px 10px rgba(0, 0, 0, 0.45),
    0 2px 0 rgba(255, 255, 255, 0.08);
  position: relative;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.stick-zone::before {
  content: "";
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  border: 1.5px dashed rgba(180, 200, 230, 0.22);
  pointer-events: none;
}

.stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 38%;
  height: 38%;
  border-radius: 50%;
  border: 2px solid #1a2030;
  background: radial-gradient(circle at 35% 30%, #c5d0e4, #6a7c9a 55%, #3a465a);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.stick-zone.active .stick-knob {
  background: radial-gradient(circle at 35% 30%, #dce6f8, #7a92bc 55%, #40506a);
}

.touch-btn {
  font-family: inherit;
  font-size: 1.5rem;
  border: 2px solid #1a2030;
  border-radius: 14px;
  background: #d8dee8;
  color: var(--ink);
  padding: 16px 8px;
  min-height: 64px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  cursor: pointer;
}

.touch-btn.fire {
  width: var(--stick-size);
  height: var(--stick-size);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #ff8a6a, #c43a2a 55%, #7a1c14);
  color: #ffe8e0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border-color: #3a1210;
  box-shadow:
    inset 0 2px 4px rgba(255, 200, 160, 0.35),
    0 3px 8px rgba(0, 0, 0, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.touch-btn.fire.is-hidden {
  display: none !important;
}

.panel-bottom {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.panel-bottom.is-hidden {
  display: none !important;
}

.touch-btn.back {
  font-size: 0.85rem;
  min-height: 34px;
  padding: 6px 10px;
  background: linear-gradient(180deg, #5a6578, #3a4558);
  color: #d8e2f0;
  border-radius: 8px;
  border-color: #1a2030;
  letter-spacing: 0.03em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.status-leds {
  display: flex;
  gap: 5px;
  padding-right: 2px;
}

.led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2a3344;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

.led.on {
  background: #3dcc7a;
  box-shadow: 0 0 8px rgba(60, 220, 120, 0.7);
}

.led.warn {
  background: #e0a030;
  box-shadow: 0 0 6px rgba(220, 160, 50, 0.55);
}

.touch-btn:active,
.touch-btn.active {
  transform: scale(0.97);
}

.touch-btn.fire:active,
.touch-btn.fire.active {
  background:
    radial-gradient(circle at 35% 30%, #ffb090, #e05030 55%, #902018);
  box-shadow:
    inset 0 2px 4px rgba(255, 220, 180, 0.45),
    0 0 16px rgba(255, 80, 40, 0.45);
}

.touch-btn.back:active {
  background: linear-gradient(180deg, #4a5568, #2e3848);
}

@media (min-width: 700px) and (pointer: fine) {
  .app {
    max-width: 520px;
    padding-top: 12px;
  }

  :root {
    --stick-size: 128px;
  }
}

/* только вертикальный вид на телефоне */
.rotate-gate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20000;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 40%, #3a4558, #1e2430 70%);
  color: #e8eef8;
  text-align: center;
  font-family: var(--game-font);
}

.rotate-gate-card {
  max-width: 320px;
  padding: 22px 20px;
  border: 2px solid #c8d2e4;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.rotate-gate-icon {
  width: 42px;
  height: 68px;
  margin: 0 auto 12px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  position: relative;
  animation: rotatePhoneHint 1.6s ease-in-out infinite;
}

.rotate-gate-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

@keyframes rotatePhoneHint {
  0%, 100% { transform: rotate(-12deg); }
  50% { transform: rotate(12deg); }
}

.rotate-gate-title {
  margin: 0 0 6px;
  font-size: 1.35rem;
}

.rotate-gate-text {
  margin: 0;
  font-size: 1.05rem;
  color: #4664a0;
}

/* телефон / планшет в landscape — блокируем игру (хаб/меню — нет) */
@media screen and (orientation: landscape) and (hover: none),
       screen and (orientation: landscape) and (max-height: 480px) {
  body.force-portrait:not(.hub-mode) .rotate-gate {
    display: grid;
  }
  body.force-portrait:not(.hub-mode) .app {
    visibility: hidden;
    pointer-events: none;
  }
  /* хаб кликабелен даже лёжа */
  body.force-portrait.hub-mode .rotate-gate {
    display: none !important;
  }
}

@media screen and (orientation: portrait) {
  body.force-portrait .rotate-gate {
    display: none !important;
  }
  body.force-portrait .app {
    visibility: visible;
    pointer-events: auto;
  }
}

/* --- аккаунт / модалка --- */
.account-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  margin-top: 4px;
  font-size: 0.85rem;
  color: #c8d2e4;
}

.acc-name {
  color: #e8eef8;
  font-weight: 600;
}

.acc-score {
  opacity: 0.75;
}

.acc-link {
  color: #9ec4ff;
  text-decoration: none;
}

.acc-link:hover {
  text-decoration: underline;
}

.acc-btn {
  border: 1px solid #6a7a94;
  background: #3a4558;
  color: #e8eef8;
  border-radius: 6px;
  padding: 4px 10px;
  font: inherit;
  cursor: pointer;
}

.acc-btn.primary {
  background: #3d6aaa;
  border-color: #6a9ad8;
}

.acc-btn.danger {
  background: #8a3a3a;
  border-color: #c07070;
}

/* ========== тетрадные страницы: вход + меню ========== */
body.nb-page {
  overflow: auto;
  min-height: 100%;
  min-height: 100dvh;
  background: #2a3344;
  font-family: var(--game-font);
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
}

body.nb-page input {
  -webkit-user-select: text;
  user-select: text;
}

.nb-sheet {
  position: relative;
  max-width: 500px;
  min-height: calc(100dvh - 24px);
  margin: 12px auto;
  background-color: var(--paper);
  background-image:
    linear-gradient(#b4cde6 1px, transparent 1px),
    linear-gradient(90deg, #b4cde6 1px, transparent 1px);
  background-size: 20px 20px;
  background-position: -1px -1px;
  border: 2px solid #6a7588;
  border-radius: 6px;
  box-shadow:
    0 0 0 3px #2a3344,
    0 10px 28px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.nb-margin {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 40px;
  width: 2px;
  background: #dc7878;
  opacity: 0.85;
  pointer-events: none;
}

.nb-content {
  position: relative;
  padding: calc(18px + var(--safe-t)) 18px calc(24px + var(--safe-b)) 56px;
}

.nb-header {
  text-align: center;
  margin-bottom: 14px;
}

.nb-eyebrow {
  margin: 0 0 4px;
  font-size: 0.95rem;
  color: #4664a0;
  letter-spacing: 0.04em;
}

.nb-title {
  margin: 0;
  font-weight: 400;
  font-size: clamp(2rem, 8vw, 2.6rem);
  color: var(--ink);
  letter-spacing: 0.06em;
  line-height: 1.05;
  text-shadow: 1px 1px 0 rgba(180, 205, 230, 0.6);
}

.nb-sub {
  margin: 8px 0 0;
  font-size: 1.05rem;
  color: #4664a0;
  line-height: 1.3;
}

.nb-doodle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 12px;
  min-height: 56px;
}

.nb-star {
  color: #4664a0;
  font-size: 1.2rem;
  opacity: 0.85;
  animation: nbTwinkle 2.8s ease-in-out infinite;
}

.nb-star:last-child {
  animation-delay: 1.2s;
}

@keyframes nbTwinkle {
  0%, 100% { opacity: 0.45; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.08); }
}

.nb-ship-img,
.nb-station-img {
  display: block;
  image-rendering: pixelated;
  filter: drop-shadow(1px 2px 0 rgba(28, 52, 118, 0.25));
  animation: nbFloat 3.2s ease-in-out infinite;
}

@keyframes nbFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.nb-section-label {
  margin: 8px 0 10px;
  font-size: 1.15rem;
  color: var(--ink);
}

.nb-panel {
  display: grid;
  gap: 10px;
  padding: 14px 14px 12px;
  background: rgba(248, 246, 236, 0.92);
  border: 2px solid var(--ink);
  border-radius: 4px;
  box-shadow: 3px 3px 0 rgba(28, 52, 118, 0.12);
}

.nb-panel-title {
  margin: 0;
  font-weight: 400;
  font-size: 1.45rem;
  color: var(--ink);
}

.nb-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.nb-tab {
  border: 2px solid var(--ink);
  background: #ebe8dc;
  color: var(--ink);
  border-radius: 4px;
  padding: 8px 10px;
  font: inherit;
  font-size: 1.05rem;
  cursor: pointer;
}

.nb-tab.is-active {
  background: #dce6f5;
  box-shadow: inset 0 0 0 1px var(--ink);
}

.nb-label {
  display: grid;
  gap: 4px;
  font-size: 1rem;
  color: var(--ink);
}

.nb-label input,
.nb-panel input {
  font: inherit;
  font-size: 1.15rem;
  padding: 10px 12px;
  border: 2px solid #8aa0c8;
  border-radius: 3px;
  background: #fffef8;
  color: var(--ink);
  outline: none;
}

.nb-label input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(28, 52, 118, 0.15);
}

.nb-error {
  margin: 0;
  min-height: 1.2em;
  color: var(--accent);
  font-size: 1rem;
}

.nb-hint {
  margin: 0;
  font-size: 0.95rem;
  color: #4664a0;
  line-height: 1.25;
}

.nb-btn {
  border: 2px solid var(--ink);
  background: #ebe8dc;
  color: var(--ink);
  border-radius: 4px;
  padding: 12px 14px;
  font: inherit;
  font-size: 1.15rem;
  cursor: pointer;
  min-height: 48px;
  box-shadow: 2px 2px 0 rgba(28, 52, 118, 0.18);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.nb-btn.primary {
  background: #dce6f5;
}

.nb-btn.danger {
  background: #ffebe6;
  border-color: #aa2d2d;
  color: #aa2d2d;
}

.nb-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(28, 52, 118, 0.18);
}

.nb-menu {
  display: grid;
  gap: 10px;
}

.nb-menu-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 8px;
  align-items: start;
  text-decoration: none;
  color: var(--ink);
  padding: 12px 12px 11px;
  background: rgba(248, 246, 236, 0.94);
  border: 2px solid var(--ink);
  border-radius: 4px;
  box-shadow: 3px 3px 0 rgba(28, 52, 118, 0.12);
  transition: background 0.15s ease, transform 0.12s ease;
}

.nb-menu-item:hover {
  background: #eef3fb;
}

.nb-menu-item:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(28, 52, 118, 0.12);
}

.nb-num {
  font-size: 1.25rem;
  line-height: 1.2;
  color: #4664a0;
}

.nb-menu-text {
  display: grid;
  gap: 2px;
  text-align: left;
}

.nb-menu-text strong {
  font-weight: 400;
  font-size: 1.15rem;
  line-height: 1.2;
}

.nb-menu-text small {
  font-size: 0.92rem;
  color: #4664a0;
  line-height: 1.25;
}

.nb-footer {
  margin-top: 18px;
  text-align: center;
}

.settings-block {
  margin-bottom: 8px;
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
  padding: 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: #fffef8;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(28, 52, 118, 0.12);
  font: inherit;
}

.settings-toggle.is-on {
  background: #dce6f5;
  box-shadow: inset 0 0 0 1px var(--ink), 2px 2px 0 rgba(28, 52, 118, 0.12);
}

.settings-toggle-label {
  font-size: 1.2rem;
  text-align: left;
}

.settings-toggle-state {
  min-width: 3.2em;
  padding: 4px 10px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  font-size: 1.05rem;
  text-align: center;
  background: #f0f4fa;
}

.settings-toggle.is-on .settings-toggle-state {
  background: #287846;
  border-color: #1a5530;
  color: #f4fff6;
}

.settings-toggle-hint {
  margin-top: 8px;
}

.settings-tab-toggle .settings-toggle-state {
  min-width: 4.5em;
  background: #f0f4fa;
  color: var(--ink);
  border-color: var(--ink);
}

.settings-tab-toggle.is-on .settings-toggle-state {
  background: #2f6fad;
  border-color: #1c3f6e;
  color: #f4f8ff;
}

.settings-tab-panel {
  margin-top: 10px;
  padding-top: 2px;
}

.settings-tab-panel.is-collapsed,
.settings-tab-panel[hidden] {
  display: none;
}

.settings-font-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.settings-font-card {
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: #fffef8;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(28, 52, 118, 0.12);
  font: inherit;
}

.settings-font-card.is-active {
  background: #dce6f5;
  box-shadow: inset 0 0 0 1px var(--ink), 2px 2px 0 rgba(28, 52, 118, 0.12);
}

.settings-font-name {
  font-size: 1.25rem;
  line-height: 1.2;
}

.settings-font-desc {
  font-size: 0.95rem;
  color: #4664a0;
}

.settings-font-sample {
  margin-top: 4px;
  font-size: 1.15rem;
  color: var(--ink);
}

.settings-font-preview {
  margin: 12px 0 0;
  padding: 12px;
  border: 1.5px dashed #8aa0c8;
  border-radius: 4px;
  font-size: 1.2rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
}

.settings-actions {
  display: grid;
  gap: 10px;
}

.settings-actions .nb-btn {
  text-decoration: none;
  text-align: center;
}

.leaders-nav {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 8px;
}

a.acc-btn {
  display: inline-block;
  text-decoration: none;
  line-height: 1.3;
}

.auth-submit {
  width: 100%;
}

.auth-switch {
  border: none;
  background: transparent;
  color: #3d6aaa;
  font: inherit;
  cursor: pointer;
  text-align: center;
  padding: 4px;
}

.auth-hint {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.7;
  line-height: 1.25;
}

/* --- лидеры --- */
body.leaders-page {
  overflow: auto;
  background: #1e2430;
  -webkit-user-select: none;
  user-select: none;
}

.leaders-app {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(12px + var(--safe-t)) 14px calc(24px + var(--safe-b));
  color: #c8d2e4;
}

.leaders-top {
  text-align: center;
  margin-bottom: 16px;
}

.leaders-top h1 {
  margin: 8px 0 4px;
  font-weight: 400;
  color: #e8eef8;
  font-size: 1.6rem;
}

.leaders-sub {
  margin: 0;
  opacity: 0.7;
  font-size: 0.9rem;
}

.leaders-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 6px;
}

.leaders-tab {
  border: 1.5px solid #6a7a94;
  background: #3a4558;
  color: #c8d2e4;
  border-radius: 8px;
  padding: 6px 14px;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.leaders-tab.is-active {
  background: #3d6aaa;
  border-color: #8ab4e8;
  color: #fff;
}

.back-home {
  display: inline-block;
  margin-bottom: 4px;
}

.leaders-panel {
  background: var(--paper);
  color: var(--ink);
  border: 2px solid #1c3476;
  border-radius: 8px;
  overflow: hidden;
}

.leaders-head,
.leaders-row {
  display: grid;
  grid-template-columns: 36px 1fr 72px 72px;
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
}

.leaders-head {
  background: #dce6f5;
  font-size: 0.85rem;
  opacity: 0.9;
  border-bottom: 1px solid #b4cde6;
}

.leaders-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.leaders-row {
  border-bottom: 1px solid #e0dcc8;
  font-size: 1.05rem;
}

.leaders-row.top .rank {
  color: #c86e28;
  font-weight: 700;
}

.leaders-row .total {
  font-weight: 600;
  text-align: right;
}

.leaders-row .best {
  text-align: right;
  opacity: 0.75;
}

.leaders-empty {
  padding: 28px 16px;
  text-align: center;
  opacity: 0.7;
}

/* --- достижения / наклейки --- */
.ach-page .nb-content {
  padding-bottom: calc(20px + var(--safe-b));
}

.ach-progress {
  height: 10px;
  margin: 4px 0 8px;
  border: 1.5px solid var(--ink, #1c3476);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.45);
  overflow: hidden;
}

.ach-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #c8ebd2, #ffe6a0);
  transition: width 0.35s ease;
}

.ach-count {
  margin: 0 0 14px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--ink, #1c3476);
  opacity: 0.85;
}

.ach-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.ach-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1.5px solid #b4c4d8;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.35);
  opacity: 0.55;
  filter: grayscale(0.35);
}

.ach-item.is-unlocked {
  opacity: 1;
  filter: none;
  border-color: var(--ink, #1c3476);
  background: #fffaf0;
  box-shadow: 2px 2px 0 rgba(28, 52, 118, 0.12);
}

.ach-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1.5px dashed #9aacc4;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #4664a0;
  background: rgba(255, 255, 255, 0.55);
}

.ach-item.is-unlocked .ach-mark {
  border-style: solid;
  border-color: #c86e28;
  color: #1c3476;
  background: #fff3d6;
  transform: rotate(-2deg);
}

.ach-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ach-body strong {
  font-size: 1.02rem;
  color: var(--ink, #1c3476);
}

.ach-body small {
  font-size: 0.82rem;
  line-height: 1.3;
  opacity: 0.8;
  color: var(--ink, #1c3476);
}

.ach-body em {
  font-style: normal;
  font-size: 0.75rem;
  opacity: 0.65;
  color: #c86e28;
}

.ach-item:not(.is-unlocked) .ach-body em {
  color: #7a8aa8;
}
