:root {
  --bg: #eff6ff;
  --bg-elevated: #ffffff;
  --bg-elevated-soft: #eff6ff;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.06);
  --accent-strong: #1d4ed8;
  --border-subtle: rgba(96, 165, 250, 0.7);
  --text: #111827;
  --text-muted: #6b7280;
  --danger: #1d4ed8;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.08);
  --shadow-subtle: 0 1px 0 rgba(148, 163, 184, 0.2);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  background: #ffffff;
  color: var(--text);
}

.intro-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #dbeafe 0, #ffffff 55%);
  z-index: 50;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.intro-card {
  padding: 22px 30px;
  border-radius: 20px;
  background: #ffffff;
  border: 1px solid rgba(191, 219, 254, 0.9);
  box-shadow: 0 22px 45px rgba(96, 165, 250, 0.35);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.intro-text {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  animation: introTextFade 1.5s ease-in-out forwards;
}

@keyframes introTextFade {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }
  20% {
    opacity: 1;
    transform: translateY(0);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.intro-overlay--hidden {
  opacity: 0;
  visibility: hidden;
}

.app-shell-hidden {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

.app-shell {
  max-width: 960px;
  margin: 32px auto;
  padding: 0 20px 32px;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 0%, #60a5fa, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  box-shadow: 0 10px 25px rgba(96, 165, 250, 0.6);
}

h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}

main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: linear-gradient(to bottom right, #ffffff, #eff6ff);
  border-radius: 24px;
  padding: 20px 20px 18px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(148, 163, 184, 0.3);
  backdrop-filter: blur(16px);
}

.card-header {
  margin-bottom: 16px;
}

.card-header h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.card-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.countdown {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.countdown-box {
  width: 180px;
  height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid rgba(191, 219, 254, 0.9);
  box-shadow: 0 18px 40px rgba(96, 165, 250, 0.15);
}

.countdown-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 8px;
}

.countdown-number {
  font-size: 30px;
  font-weight: 700;
  color: #3b82f6;
  text-shadow: none;
}

.table-container {
  margin-top: 10px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(191, 219, 254, 0.9);
  background: #ffffff;
}

.loading,
.error {
  padding: 18px 20px;
  font-size: 14px;
}

.error {
  color: var(--danger);
}

.exam-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.exam-table thead {
  background: #ffffff;
}

.exam-table th,
.exam-table td {
  padding: 10px 14px;
  text-align: left;
}

.exam-table th {
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid rgba(96, 165, 250, 0.4);
  position: relative;
}

.exam-table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.exam-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.exam-table tbody tr:hover {
  background: #eff6ff;
  box-shadow: inset 3px 0 0 rgba(96, 165, 250, 0.5);
}

.exam-table tbody tr.row-past {
  background: #eff6ff;
}

.exam-table tbody tr.row-today {
  background: #fffbeb;
}

.date-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.weekday {
  font-size: 12px;
  color: var(--accent-strong);
  display: block;
}

.exam-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  margin: 2px 4px 2px 0;
  border: 1px solid rgba(209, 213, 219, 0.9);
}

.exam-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 999px;
  margin-right: 6px;
  background: radial-gradient(circle at 30% 0%, #9ca3af, #6b7280);
  box-shadow: 0 0 0 3px rgba(209, 213, 219, 0.8);
}

.exam-pill-english-b {
  background: #eff6ff;
  border-color: #60a5fa;
  color: #1d4ed8;
}

.exam-pill-english-b::before {
  background: radial-gradient(circle at 30% 0%, #60a5fa, #2563eb);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.4);
}

.exam-pill-self-taught {
  background: #fef3c7;
  border-color: #facc15;
  color: #b45309;
}

.exam-pill-self-taught::before {
  background: radial-gradient(circle at 30% 0%, #fbbf24, #facc15);
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.45);
}

.exam-pill-physics {
  background: #ecfeff;
  border-color: #22d3ee;
  color: #0f766e;
}

.exam-pill-physics::before {
  background: radial-gradient(circle at 30% 0%, #22d3ee, #06b6d4);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.45);
}

.exam-pill-psychology {
  background: #f5f3ff;
  border-color: #a855f7;
  color: #6b21a8;
}

.exam-pill-psychology::before {
  background: radial-gradient(circle at 30% 0%, #a855f7, #8b5cf6);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.45);
}

.exam-pill-economics {
  background: #ecfdf5;
  border-color: #34d399;
  color: #047857;
}

.exam-pill-economics::before {
  background: radial-gradient(circle at 30% 0%, #34d399, #10b981);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.45);
}

.exam-pill-mathematics {
  background: #eef2ff;
  border-color: #818cf8;
  color: #3730a3;
}

.exam-pill-mathematics::before {
  background: radial-gradient(circle at 30% 0%, #818cf8, #4f46e5);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.45);
}

.exam-pill {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.exam-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.exam-pill--active {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.25);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.exam-tooltip {
  position: absolute;
  z-index: 9999;
  min-width: 210px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid rgba(191, 219, 254, 0.9);
  box-shadow: 0 16px 40px rgba(37, 99, 235, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
  font-size: 13px;
  animation: tooltipIn 0.18s ease-out;
}

@keyframes tooltipIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.tooltip-row + .tooltip-row {
  border-top: 1px solid rgba(191, 219, 254, 0.3);
}

.tooltip-label {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tooltip-value {
  font-weight: 600;
  color: var(--text);
}

.tooltip-tz {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(191, 219, 254, 0.5);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #dbeafe;
  border: 1px solid rgba(96, 165, 250, 0.9);
  font-size: 11px;
  color: var(--text-muted);
}

.app-footer {
  margin-top: 16px;
  padding: 10px 4px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.3);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-footer a {
  color: var(--accent-strong);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .app-shell {
    margin-top: 20px;
  }

  .card {
    padding: 16px 14px 14px;
  }

  .table-container {
    border-radius: 16px;
    overflow: visible;
    border-width: 0;
  }

  .exam-table {
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .exam-table tbody tr {
    display: block;
    padding: 10px 12px;
    margin: 0 0 8px;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
  }

  .exam-table tbody tr:hover {
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.09);
    background: #eff6ff;
  }

  .exam-table td {
    display: block;
    padding: 4px 0;
  }

  .exam-table td.date-cell {
    font-weight: 600;
    margin-bottom: 4px;
  }

  .exam-table td:last-child {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
  }
}
