:root {
  --bg: #020617;
  --bg-soft: #0f172a;
  --panel: rgba(15, 23, 42, 0.88);
  --panel-strong: rgba(15, 23, 42, 0.96);
  --border: rgba(71, 85, 105, 0.85);
  --border-soft: rgba(71, 85, 105, 0.45);

  --text-main: #e5e7eb;
  --text-sub: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.25);
  --accent-strong: rgba(56, 189, 248, 0.95);

  --locked: #16a34a;
  --unlocked: #f97316;
  --none-bg: rgba(30, 41, 59, 0.65);

  --full-orgasm: #ef4444;
  --ruined-orgasm: #a855f7;
  --caged-orgasm: #f59e0b;
  --no-cum: #22c55e;
  --hygiene-unlock: #38bdf8;

  --success-soft: rgba(34, 197, 94, 0.12);
  --warning-soft: rgba(249, 115, 22, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, 0.08), transparent 30%),
    linear-gradient(180deg, #020617 0%, #020617 100%);
  color: var(--text-main);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body { padding: 18px; }

.app-shell {
  max-width: 1320px;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(2,6,23,0.96), rgba(15,23,42,0.94));
  border: 1px solid rgba(71, 85, 105, 0.8);
  border-radius: 20px;
  box-shadow:
    0 22px 60px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.app-content { padding: 22px 20px 24px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.22);
}

header { display: grid; gap: 14px; margin-bottom: 14px; }
.hero { display: grid; gap: 10px; }

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 750;
  color: #f8fafc;
}

.hero-kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.subtitle {
  max-width: 840px;
  font-size: 13px;
  line-height: 1.72;
  color: var(--text-sub);
  white-space: pre-line;
}

.status-strip {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 10px;
}

.status-box {
  background: rgba(15,23,42,0.92);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 76px;
}

.status-box.primary {
  background:
    radial-gradient(circle at top right, rgba(34,197,94,0.10), transparent 35%),
    rgba(15,23,42,0.95);
}

.status-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.status-value { font-size: 18px; font-weight: 700; color: #f8fafc; }
.status-subtext { font-size: 11px; color: var(--text-muted); }

.top-bar {
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.year-select {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.year-input,
.btn,
#loginUser,
#loginPass {
  background: #020617;
  color: var(--text-main);
  border: 1px solid rgba(148,163,184,0.6);
  border-radius: 10px;
  font-size: 12px;
}

.year-input { width: 88px; padding: 7px 9px; }

.btn {
  padding: 7px 11px;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
  transform: translateY(-0.5px);
}

.view-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.view-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(22,163,74,0.12);
  border: 1px solid rgba(22,163,74,0.45);
  color: #dcfce7;
  font-size: 11px;
}

.view-badge.readonly {
  background: rgba(148,163,184,0.12);
  border-color: rgba(148,163,184,0.35);
  color: #e2e8f0;
}

.view-dot { width: 8px; height: 8px; border-radius: 999px; background: currentColor; }

#loginForm { display: flex; align-items: center; gap: 6px; font-size: 11px; flex-wrap: wrap; }
#loginUser, #loginPass { width: 106px; padding: 6px 8px; }

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.grid-card { margin-top: 14px; }

.grid-header-row,
.grid-body {
  display: grid;
  grid-template-columns: 84px repeat(31, minmax(18px, 1fr));
  gap: 4px;
}

.grid-header-row { margin-bottom: 6px; }

.grid-header-cell,
.month-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  border-radius: 8px;
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(15,23,42,0.4);
  border: 1px solid rgba(55,65,81,0.45);
}

.month-label {
  justify-content: flex-start;
  padding-left: 8px;
  font-size: 11px;
  color: #e2e8f0;
  background: rgba(15,23,42,0.7);
}

.day-cell {
  position: relative;
  min-height: 18px;
  border-radius: 6px;
  border: 1px solid rgba(71,85,105,0.6);
  background: var(--none-bg);
  cursor: pointer;
  transition: box-shadow 0.1s ease, transform 0.08s ease, border-color 0.12s ease;
}

.day-cell.empty { background: transparent; border: none; cursor: default; }
.day-cell:hover { box-shadow: 0 0 0 1px var(--accent-strong); transform: translateY(-0.6px); }
.day-cell.readonly { cursor: default; }
.day-cell.readonly:hover { box-shadow: none; transform: none; }

.day-main-locked {
  background:
    radial-gradient(circle at 20% 10%, rgba(34,197,94,0.4), transparent 55%),
    linear-gradient(135deg, #16a34a, #15803d);
  border-color: rgba(22,163,74,0.95);
}

.day-main-unlocked {
  background:
    radial-gradient(circle at 20% 10%, rgba(251,146,60,0.5), transparent 55%),
    linear-gradient(135deg, #f97316, #ea580c);
  border-color: rgba(249,115,22,0.95);
}

.day-today {
  box-shadow:
    0 0 0 1px rgba(56,189,248,0.95),
    0 0 0 3px rgba(56,189,248,0.35);
}

.extra-dot {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(15,23,42,0.95);
}

.extra-full_orgasm { background: var(--full-orgasm); }
.extra-ruined_orgasm { background: var(--ruined-orgasm); }
.extra-caged_orgasm { background: var(--caged-orgasm); }
.extra-no_cum { background: var(--no-cum); }
.extra-hygiene_unlock { background: var(--hygiene-unlock); }

.legend-row { margin-top: 12px; }
.legend-block { display: grid; gap: 10px; }
.legend-group { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; }
.legend-group-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-sub); margin-right: 2px; }

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(55,65,81,0.9);
  font-size: 11px;
  color: var(--text-muted);
}

.legend-swatch-main { width: 14px; height: 14px; border-radius: 4px; border: 1px solid #4b5563; background: var(--none-bg); }
.legend-swatch-main.locked { background: var(--locked); }
.legend-swatch-main.unlocked { background: var(--unlocked); }

.legend-dot-wrapper {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid #4b5563;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.legend-dot { width: 9px; height: 9px; border-radius: 999px; background: currentColor; }

.bottom-layout {
  display: grid;
  grid-template-columns: 1.1fr 1.35fr;
  gap: 14px;
  margin-top: 14px;
}

.stack { display: grid; gap: 14px; }
.panel-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); margin-bottom: 8px; }
.protocol-copy { display: grid; gap: 10px; font-size: 12px; line-height: 1.65; color: var(--text-sub); }
.protocol-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--text-sub); font-size: 12px; line-height: 1.55; }

.social-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.social-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--text-muted); }

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(148,163,184,0.45);
  font-size: 11px;
  color: #e5e7eb;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, box-shadow 0.1s;
}

.social-link:hover { background: rgba(15,23,42,1); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); transform: translateY(-0.5px); }
.social-icon { width: 18px; height: 18px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #020617; }
.icon-recon { background: #f97316; }
.icon-twitter { background: #0ea5e9; }
.icon-bluesky { background: #38bdf8; }
.icon-telegram { background: #229ED9; }

.registry-id {
  font-size: 11px;
  color: #e5e7eb;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(148,163,184,0.45);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.registry-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.registry-value { font-weight: 600; }
.social-note { font-size: 10px; color: var(--text-muted); margin-top: 8px; line-height: 1.55; }

.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; font-size: 11px; }
.stat-column { display: flex; flex-direction: column; gap: 6px; }
.stat-group-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-sub); margin-bottom: 2px; }

.stat-box {
  background: rgba(15,23,42,0.9);
  border-radius: 10px;
  border: 1px solid rgba(55,65,81,0.9);
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 58px;
  justify-content: center;
}

.stat-label { color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-size: 16px; font-weight: 700; color: #f8fafc; }

.cell-tooltip {
  position: fixed;
  pointer-events: none;
  background: rgba(15,23,42,0.98);
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,0.6);
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-main);
  box-shadow:
    0 14px 30px rgba(0,0,0,0.8),
    0 0 0 1px rgba(15,23,42,0.9);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.08s ease-out, transform 0.08s ease-out;
  z-index: 999;
  white-space: nowrap;
}

.cell-tooltip.visible { opacity: 1; transform: translateY(0); }
.cell-tooltip-title { font-weight: 700; margin-bottom: 2px; }
.cell-tooltip-line { color: var(--text-muted); }

@media (max-width: 1100px) {
  .status-strip { grid-template-columns: repeat(2, 1fr); }
  .bottom-layout { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  body { padding: 12px; }
  .app-content { padding: 16px 12px 18px; }
  .grid-header-row,
  .grid-body { grid-template-columns: 70px repeat(31, minmax(16px, 1fr)); }
  .month-label { font-size: 10px; }
  .stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { padding: 8px; }
  .status-strip { grid-template-columns: 1fr; }
  h1 { font-size: 23px; }
  .subtitle { font-size: 12px; }
}
