:root {
  --bg: #0b0f14;
  --bg-elevated: #121820;
  --bg-card: #161d27;
  --border: rgba(255, 255, 255, 0.08);
  --text: #eef2f7;
  --text-muted: #8b98a8;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Instrument Sans", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

/* Skill landing */

.skill-landing,
.skill-placeholder {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 100vh;
  padding: 32px;
  background:
    radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.15), transparent 30%),
    radial-gradient(circle at 85% 85%, rgba(99, 102, 241, 0.14), transparent 28%),
    var(--bg);
}

.skill-landing-header,
.skill-grid,
.placeholder-panel {
  width: min(960px, 100%);
}

.skill-landing-header {
  margin-bottom: 0;
}

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

.landing-brand .eyebrow {
  margin-bottom: 4px;
}

.landing-brand h1,
.placeholder-panel h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.25rem);
  letter-spacing: -0.04em;
}

.skill-landing-header > p,
.placeholder-panel > p:last-child {
  margin: 18px 0 0 60px;
  color: var(--text-muted);
  line-height: 1.6;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.skill-landing {
  gap: 32px;
}

.skill-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  min-height: 180px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.skill-card:not(:disabled):hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: var(--shadow);
}

.skill-card-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
  font-size: 1.45rem;
}

.skill-listening .skill-card-icon {
  background: rgba(45, 212, 191, 0.12);
  color: #5eead4;
}

.skill-card-body {
  display: grid;
  align-content: start;
  gap: 8px;
}

.skill-card-body strong {
  font-size: 1.2rem;
}

.skill-card-body span,
.skill-card-action {
  color: var(--text-muted);
  line-height: 1.5;
}

.skill-card-action {
  grid-column: 2;
  align-self: end;
  color: #7dd3fc;
  font-size: 0.9rem;
  font-weight: 600;
}

.skill-coming-soon {
  cursor: not-allowed;
  opacity: 0.58;
}

.skill-coming-soon .skill-card-icon {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.skill-coming-soon .skill-card-action {
  color: var(--text-muted);
}

.skill-home-btn {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
}

.skill-home-btn:hover {
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--text);
}

.placeholder-panel {
  padding: 40px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.placeholder-panel .eyebrow {
  margin: 36px 0 8px;
}

/* Login */

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.login-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.18), transparent 30%),
    radial-gradient(circle at 80% 0%, rgba(139, 92, 246, 0.16), transparent 28%),
    var(--bg);
}

.login-card {
  position: relative;
  width: min(420px, calc(100vw - 32px));
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(18, 24, 32, 0.88);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.login-brand,
.sidebar-header {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  color: white;
  font-weight: 700;
}

.login-brand h1,
.sidebar-header h1 {
  margin: 0;
  font-size: 1.2rem;
}

.login-brand p,
.sidebar-header p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.app-version {
  display: inline-flex;
  margin-top: 8px;
  padding: 4px 10px;
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.08);
  color: #9bdcff;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.login-form label {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.login-form input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
}

.login-form button,
.btn-primary {
  padding: 14px 18px;
  border: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.login-error {
  margin: 0;
  color: #fb7185;
  font-size: 0.9rem;
}

/* App layout */

.app {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 20px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, #10161f, #0d1218);
}

.sidebar-section h2 {
  margin: 0 0 12px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.category-nav {
  display: grid;
  gap: 8px;
}

.category-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: 0.18s ease;
}

.category-btn:hover,
.category-btn.active {
  background: var(--accent-soft);
  border-color: rgba(56, 189, 248, 0.25);
}

.listening-part-nav .category-btn:disabled {
  color: var(--text-muted);
  cursor: default;
  opacity: 0.8;
}

.listening-part-nav .category-btn:disabled:hover {
  border-color: transparent;
  background: transparent;
}

.category-btn .count {
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

.category-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.field select,
.search-wrap input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
}

.logout-form {
  margin-top: auto;
}

.btn-ghost {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.main {
  padding: 28px 32px 48px;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.main-header h2 {
  margin: 0;
  font-size: clamp(1.6rem, 2vw, 2.2rem);
}

.search-wrap {
  width: min(360px, 100%);
}

.category-hero {
  margin-bottom: 24px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
}

.category-hero h3 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.category-hero p {
  margin: 0;
  color: var(--text-muted);
  max-width: 60ch;
  line-height: 1.6;
}

.question-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.question-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.question-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 0.78rem;
}

.pill.accent {
  background: var(--accent-soft);
  color: #7dd3fc;
}

.question-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
}

.question-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 48px 0;
}

/* Modal */

.question-modal {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow);
}

.question-modal::backdrop {
  background: rgba(3, 7, 12, 0.72);
  backdrop-filter: blur(4px);
}

.modal-inner {
  position: relative;
  padding: 28px;
  overflow: auto;
  max-height: calc(100vh - 32px);
}

.modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-right: 44px;
}

.modal-position {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.modal-nav-btn {
  min-width: 44px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  transition: 0.15s ease;
}

.modal-nav-btn:hover:not(:disabled) {
  border-color: rgba(56, 189, 248, 0.4);
  background: var(--accent-soft);
}

.modal-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#modal-content {
  transition: opacity 0.18s ease, transform 0.18s ease;
}

#modal-content.modal-slide-left {
  animation: modal-in-right 0.2s ease;
}

#modal-content.modal-slide-right {
  animation: modal-in-left 0.2s ease;
}

@keyframes modal-in-right {
  from {
    opacity: 0.4;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes modal-in-left {
  from {
    opacity: 0.4;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.modal-content h2 {
  margin: 0 0 10px;
  padding-right: 40px;
  font-size: 1.5rem;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.modal-section {
  margin-top: 22px;
}

.modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}

.modal-aside {
  position: sticky;
  top: 0;
}

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

.modal-section p,
.option-block {
  margin: 0;
  line-height: 1.7;
  color: #d7dee8;
}

.listening-player {
  display: grid;
  gap: 18px;
}

.listening-audio,
.listening-video {
  width: 100%;
}

.listening-video {
  max-height: 60vh;
  border-radius: var(--radius-sm);
  background: #05080c;
}

.listening-playlist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.listening-track {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  cursor: pointer;
}

.listening-track:hover,
.listening-track.active {
  border-color: rgba(45, 212, 191, 0.45);
  background: rgba(45, 212, 191, 0.12);
  color: #99f6e4;
}

.option-block {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.option-block + .option-block {
  margin-top: 10px;
}

.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.vocab-card {
  padding: 14px 16px;
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(56, 189, 248, 0.1), rgba(99, 102, 241, 0.08)),
    rgba(255, 255, 255, 0.02);
  color: #e6f4ff;
  font-weight: 600;
  line-height: 1.55;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 280px));
  gap: 12px;
}

.image-frame {
  width: 100%;
  max-width: 280px;
  height: 200px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #0a0e13;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.modal-content.category-describing-a-scene .image-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 340px));
}

.modal-content.category-describing-a-scene .image-frame {
  max-width: 340px;
  height: 240px;
}

.image-grid img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0a0e13;
  cursor: zoom-in;
}

/* Lightbox */
.lightbox[open] {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(0, 0, 0, 0.92);
  display: grid;
  place-items: center;
}

.lightbox::backdrop {
  background: transparent;
}

.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 48px rgba(0,0,0,0.6);
}

.lightbox-close {
  position: fixed;
  top: 16px;
  right: 20px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 10;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.2);
}

@media (max-width: 620px) {
  .skill-landing,
  .skill-placeholder {
    padding: 20px;
  }

  .skill-grid {
    grid-template-columns: 1fr;
  }

  .skill-landing-header > p,
  .placeholder-panel > p:last-child {
    margin-left: 0;
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .main-header {
    flex-direction: column;
    align-items: stretch;
  }
}

.answer-toggle {
  display: block;
  width: 100%;
  padding: 12px 16px;
  margin: 0;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(99, 102, 241, 0.1));
  color: #38bdf8;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.answer-toggle:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(99, 102, 241, 0.15));
  border-color: rgba(56, 189, 248, 0.5);
}

.answer-toggle:active {
  transform: scale(0.98);
}

.answer-box {
  margin-top: 12px;
  padding: 16px;
  border-left: 3px solid #38bdf8;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.08);
  color: #e6f4ff;
  line-height: 1.7;
  font-size: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.answer-box.hidden {
  display: none;
}

@media (max-width: 900px) {
  .modal-layout {
    grid-template-columns: 1fr;
  }

  .modal-aside {
    position: static;
  }
}
