/* ═══════════════════════════════════════════════════════════════
   STUDSYS — Splash Screen + License Dialog
   Complete stylesheet: splash layout, license dialog, sync overlay
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Background gradient */
  --bg-1: #1a0605;
  --bg-2: #2B0F0C;
  --bg-3: #803932;
  --bg-4: #5A231E;

  /* Brand colours */
  --accent: #F5C6A0;
  --accent-hover: #FFE0C0;
  --green: #7CFC9B;
  --red: #FF6B6B;
  --yellow: #FFD966;

  /* Text */
  --text-white: #FFFFFF;
  --text-dim: rgba(255, 255, 255, 0.85);
  --text-muted: rgba(255, 255, 255, 0.70);
  --text-subtle: rgba(255, 255, 255, 0.45);
  --text-faint: rgba(255, 255, 255, 0.35);

  /* Card */
  --card-bg: rgba(0, 0, 0, 0.28);
  --card-border: rgba(245, 198, 160, 0.35);
  --divider: rgba(255, 255, 255, 0.15);

  /* Fonts */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Consolas", "Courier New", monospace;

  /* Safe-area insets (notch / home bar) */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  touch-action: manipulation;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--text-white);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-y: auto;
}

/* ═══════════════════════════════════════════════════════════════
   SPLASH LAYOUT
   ═══════════════════════════════════════════════════════════════ */

.splash-container {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  background: linear-gradient(
    to bottom right,
    var(--bg-1) 0%,
    var(--bg-2) 30%,
    var(--bg-3) 70%,
    var(--bg-4) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding:
    calc(20px + var(--safe-top))
    calc(20px + var(--safe-right))
    calc(20px + var(--safe-bottom))
    calc(20px + var(--safe-left));
}

/* Decorative background glows */
.glow {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.glow-1 {
  width: min(800px, 90vw);
  height: min(800px, 90vw);
  background: rgba(255, 255, 255, 0.03);
}

.glow-2 {
  width: min(1100px, 120vw);
  height: min(1100px, 120vw);
  background: rgba(255, 255, 255, 0.02);
}

/* Content column */
.splash-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 760px;
  width: 100%;
  padding: 30px 40px;
  text-align: center;
}

/* Graduation cap icon */
.cap-icon {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  filter: drop-shadow(0 2px 10px rgba(255, 255, 255, 0.15));
}

.cap-icon svg {
  width: 100%;
  height: 100%;
}

/* Brand text */
.welcome-text {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.35em;
  margin-left: 0.35em;
}

.brand-title {
  color: var(--text-white);
  font-size: clamp(32px, 8vw, 60px);
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.05;
  margin-left: 0.12em;
  white-space: nowrap;
}

.brand-subtitle {
  color: var(--accent);
  font-size: clamp(11px, 2.5vw, 14px);
  font-weight: 700;
  letter-spacing: 0.25em;
  margin-left: 0.25em;
}

.school-name {
  color: var(--text-dim);
  font-size: 17px;
  font-style: italic;
  margin-top: 10px;
}

.days-left {
  color: var(--green);
  font-size: 15px;
  font-weight: 700;
  margin-top: 4px;
  min-height: 1.4em;
}

/* Divider */
.divider {
  width: 420px;
  max-width: 100%;
  height: 1px;
  background: var(--divider);
  margin: 20px 0 10px;
}

/* Support card */
.support-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 560px;
  padding: 16px 32px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  margin-top: 10px;
}

.support-title {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.phone-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 40px;
  margin-top: 4px;
  width: 100%;
  max-width: 400px;
}

.phone {
  color: var(--text-white);
  font-size: 17px;
  font-family: var(--font-mono);
  padding: 8px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: all;
  white-space: nowrap;
  text-align: center;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.phone:hover {
  background: rgba(245, 198, 160, 0.15);
  color: var(--accent);
}

.phone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.phone.copied {
  color: var(--green);
  background: rgba(124, 252, 155, 0.12);
}

.copy-hint {
  color: var(--text-subtle);
  font-size: 10px;
  font-style: italic;
  margin-top: 2px;
}

/* Splash buttons */
.btn-proceed,
.btn-dashboard {
  width: 100%;
  max-width: 460px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.03em;
  min-height: 48px;
}

.btn-proceed {
  background: var(--accent);
  color: var(--bg-2);
  border: none;
  font-size: 16px;
  padding: 18px 44px;
  margin-top: 24px;
}

.btn-proceed:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 24px rgba(245, 198, 160, 0.55);
  transform: translateY(-1px);
}

.btn-proceed:active {
  transform: translateY(0);
  box-shadow: 0 0 12px rgba(245, 198, 160, 0.4);
}

.btn-proceed:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.btn-dashboard {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  font-size: 14px;
  padding: 14px 44px;
  margin-top: 12px;
}

.btn-dashboard:hover {
  background: rgba(245, 198, 160, 0.10);
  box-shadow: 0 0 16px rgba(245, 198, 160, 0.30);
}

.btn-dashboard:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.footer-version {
  color: var(--text-faint);
  font-size: 10px;
  margin-top: 20px;
}

/* ═══════════════════════════════════════════════════════════════
   LICENSE DIALOG + SYNC OVERLAY
   ═══════════════════════════════════════════════════════════════ */

.license-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.license-dialog {
  background: linear-gradient(to bottom right, #1a0605, #2B0F0C);
  border: 2px solid #F5C6A0;
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.license-title {
  color: var(--accent);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px 0;
  text-align: center;
}

.license-subtitle {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  margin: 0 0 20px 0;
}

.license-subtitle strong {
  color: var(--accent);
}

.license-label {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 6px 0;
}

.license-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 10px;
  border: 2px solid rgba(245, 198, 160, 0.3);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 16px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-align: center;
}

.license-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(245, 198, 160, 0.3);
}

.license-error {
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
  min-height: 1.2em;
  margin: 8px 0 16px 0;
  text-align: center;
}

.license-btn-primary,
.license-btn-secondary {
  width: 100%;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  min-height: 48px;
}

.license-btn-primary {
  background: var(--accent);
  color: var(--bg-2);
  margin-bottom: 8px;
}

.license-btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 0 20px rgba(245, 198, 160, 0.5);
}

.license-btn-primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.license-btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 2px solid rgba(245, 198, 160, 0.4);
}

.license-btn-secondary:hover {
  background: rgba(245, 198, 160, 0.1);
  border-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .splash-content { padding: 24px 28px; }
  .divider       { width: 90%; margin: 18px 0 10px; }
  .support-card  { padding: 14px 22px; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — PHONES
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  .splash-container {
    padding:
      calc(16px + var(--safe-top))
      calc(14px + var(--safe-right))
      calc(16px + var(--safe-bottom))
      calc(14px + var(--safe-left));
    align-items: flex-start;
  }
  .splash-content { padding: 16px 12px; gap: 8px; }

  .cap-icon { width: 68px; height: 68px; margin-bottom: 2px; }

  .welcome-text  { font-size: 11px; letter-spacing: 0.30em; margin-left: 0.30em; }
  .brand-title   { font-size: clamp(38px, 12vw, 52px); letter-spacing: 0.10em; margin-left: 0.10em; }
  .brand-subtitle{ font-size: 11px; letter-spacing: 0.20em; margin-left: 0.20em; }

  .school-name { font-size: 15px; margin-top: 6px; }
  .days-left   { font-size: 13px; }

  .divider { width: 100%; margin: 14px 0 8px; }

  .support-card  { padding: 12px 14px; margin-top: 8px; max-width: 100%; }
  .support-title { font-size: 11px; }

  .phone-grid { grid-template-columns: 1fr; gap: 4px; margin-top: 6px; }
  .phone      { font-size: 17px; padding: 10px 6px; min-height: 48px;
                border: 1px solid rgba(245, 198, 160, 0.12); }

  .btn-proceed   { padding: 16px 20px; font-size: 15px; margin-top: 18px; }
  .btn-dashboard { padding: 14px 20px; font-size: 13px; margin-top: 10px; }

  .footer-version { font-size: 9px; margin-top: 16px; }

  .license-dialog { padding: 24px 18px; }
  .license-title  { font-size: 19px; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — SMALL PHONES
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 400px) {
  .splash-content { padding: 12px 8px; }
  .cap-icon { width: 56px; height: 56px; }

  .welcome-text   { font-size: 10px; letter-spacing: 0.25em; margin-left: 0.25em; }
  .brand-title    { font-size: 38px; letter-spacing: 0.08em; margin-left: 0.08em; }
  .brand-subtitle { font-size: 10px; letter-spacing: 0.15em; margin-left: 0.15em; }

  .support-card { padding: 10px 10px; }
  .phone        { font-size: 16px; padding: 8px 4px; min-height: 44px; }

  .btn-proceed   { font-size: 14px; padding: 14px 16px; }
  .btn-dashboard { font-size: 12px; padding: 12px 16px; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — LANDSCAPE PHONE
   ═══════════════════════════════════════════════════════════════ */

@media (max-height: 500px) and (orientation: landscape) {
  .splash-container {
    align-items: center;
    padding:
      calc(10px + var(--safe-top))
      calc(20px + var(--safe-right))
      calc(10px + var(--safe-bottom))
      calc(20px + var(--safe-left));
  }
  .splash-content { gap: 4px; padding: 10px 20px; }

  .cap-icon { width: 44px; height: 44px; margin-bottom: 0; }
  .brand-title    { font-size: 32px; letter-spacing: 0.08em; margin-left: 0.08em; }
  .brand-subtitle { font-size: 10px; }

  .divider { margin: 8px 0 6px; }
  .support-card { padding: 8px 14px; margin-top: 4px; }

  .phone-grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .phone      { font-size: 13px; padding: 4px 4px; min-height: 36px; }

  .btn-proceed   { padding: 10px 20px; font-size: 13px; margin-top: 8px; }
  .btn-dashboard { padding: 8px 20px;  font-size: 12px; margin-top: 6px; }

  .footer-version { margin-top: 8px; }
}

/* ═══════════════════════════════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}