:root {
  color-scheme: dark;
  --bg: #0c0e11;
  --panel: #15191f;
  --panel-2: #1d232b;
  --line: #2d3540;
  --text: #f4f0e7;
  --muted: #aeb7c2;
  --gold: #e6b54a;
  --blue: #65b7e7;
  --coral: #df8262;
  --green: #79c894;
  --danger: #d45757;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.shell {
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(340px, 420px) 1fr;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #11151a;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  overflow: hidden;
}

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

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(230, 181, 74, 0.7);
  color: var(--gold);
  font-weight: 800;
  border-radius: 6px;
  background: rgba(230, 181, 74, 0.08);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.brand h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  line-height: 1;
}

.brand p,
.search span,
.meta,
.muted {
  color: var(--muted);
}

.brand p {
  font-size: 13px;
  margin-top: 5px;
}

.membership {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(230, 181, 74, 0.45);
  border-radius: 8px;
  padding: 12px;
  background: rgba(230, 181, 74, 0.08);
}

.membership strong,
.membership span {
  display: block;
}

.membership strong {
  font-size: 14px;
  color: #ffe7a7;
}

.membership span {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.login-button {
  min-height: 34px;
  border: 1px solid rgba(230, 181, 74, 0.65);
  border-radius: 7px;
  padding: 0 12px;
  color: #ffe7a7;
  background: rgba(230, 181, 74, 0.12);
  cursor: pointer;
  white-space: nowrap;
}

.login-button.active {
  border-color: var(--green);
  color: #c9f5d5;
  background: rgba(121, 200, 148, 0.12);
}

.auth-modal[hidden] {
  display: none;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.auth-dialog {
  position: relative;
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #12171d;
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-dialog h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
}

.auth-dialog p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--panel);
  cursor: pointer;
}

.google-login,
.primary-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(230, 181, 74, 0.7);
  border-radius: 7px;
  color: #ffe7a7;
  background: rgba(230, 181, 74, 0.12);
  text-decoration: none;
  padding: 0 14px;
  cursor: pointer;
}

.google-login {
  width: 100%;
  margin-top: 18px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.email-login-form {
  display: grid;
  gap: 12px;
}

.email-login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.email-login-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--panel);
  outline: none;
  padding: 0 12px;
}

.email-login-form input:focus {
  border-color: var(--blue);
}

.auth-status {
  min-height: 20px;
  font-size: 13px;
}

.search {
  display: grid;
  gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
}

.search input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
  border-radius: 7px;
  outline: none;
  padding: 0 13px;
}

.search input:focus {
  border-color: var(--blue);
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stats div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: var(--panel);
  text-align: center;
}

.stats strong {
  display: block;
  font-size: 24px;
}

.stats span {
  color: var(--muted);
  font-size: 12px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.roots-filter {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.roots-filter[hidden] {
  display: none;
}

.roots-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.roots-filter-head button {
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--panel);
  padding: 0 10px;
  cursor: pointer;
}

.root-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 120px;
  overflow: auto;
}

.root-filter-chip {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #d8efff;
  background: rgba(101, 183, 231, 0.08);
  padding: 0 10px;
  cursor: pointer;
}

.root-filter-chip.active {
  border-color: rgba(230, 181, 74, 0.9);
  color: #ffe7a7;
  background: rgba(230, 181, 74, 0.14);
}

.root-filter-empty {
  color: var(--muted);
  font-size: 12px;
}

.playlist-panel {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(101, 183, 231, 0.28);
  border-radius: 8px;
  padding: 10px;
  background: rgba(101, 183, 231, 0.06);
}

.playlist-title {
  color: #d8efff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.playback-tools {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
}

.playback-button {
  min-height: 38px;
  border: 1px solid rgba(101, 183, 231, 0.45);
  border-radius: 7px;
  color: #d8efff;
  background: rgba(101, 183, 231, 0.1);
  cursor: pointer;
}

.playback-button:hover {
  border-color: rgba(101, 183, 231, 0.85);
  background: rgba(101, 183, 231, 0.16);
}

.playback-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.playback-button.stop {
  border-color: rgba(212, 87, 87, 0.55);
  color: #ffd4d4;
  background: rgba(212, 87, 87, 0.12);
}

.queue-status {
  min-height: 15px;
  color: var(--muted);
  font-size: 12px;
}

.tab,
.icon-button,
.primary-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--panel);
  min-height: 38px;
  cursor: pointer;
}

.tab.active,
.primary-button {
  border-color: rgba(230, 181, 74, 0.8);
  background: rgba(230, 181, 74, 0.13);
  color: #ffe7a7;
}

.list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding-right: 3px;
}

.word-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  color: var(--text);
}

.word-row.active {
  border-color: var(--gold);
  background: #202027;
}

.word-row.locked {
  opacity: 0.78;
}

.thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  background: #08090b;
}

.word-row h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.word-row .meta {
  font-size: 12px;
}

.save-star {
  color: var(--muted);
  font-size: 11px;
}

.save-star.saved {
  color: var(--gold);
}

.row-actions {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.premium-badge,
.free-badge {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.premium-badge {
  border: 1px solid rgba(230, 181, 74, 0.65);
  color: #ffe7a7;
  background: rgba(230, 181, 74, 0.1);
}

.free-badge {
  border: 1px solid rgba(101, 183, 231, 0.5);
  color: #bfe9ff;
  background: rgba(101, 183, 231, 0.08);
}

.detail {
  min-width: 0;
  padding: 28px;
  background: #0c0e11;
  height: 100vh;
  overflow-y: auto;
}

.empty {
  height: calc(100vh - 56px);
  display: grid;
  place-content: center;
  text-align: center;
  gap: 8px;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(380px, 480px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.video-pane {
  position: sticky;
  top: 28px;
}

.video-inner {
  position: relative;
}

.video-inner video {
  width: auto !important;
  max-width: 100%;
  max-height: calc(100vh - 224px);
  height: auto;
  display: block;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.views-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, 0.68);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
}

.views-badge.hidden {
  display: none;
}

.views-badge-icon {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
}

.views-badge-icon svg {
  width: 14px;
  height: 14px;
  display: block;
  fill: currentColor;
}

.initial-play-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.initial-play-overlay.hidden {
  display: none;
}

.initial-play-overlay span {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
  transition: transform 0.15s, background 0.15s;
}

.initial-play-overlay svg {
  width: 42px;
  height: 42px;
  margin-left: 4px;
  fill: currentColor;
}

.initial-play-overlay:hover span {
  background: rgba(0, 0, 0, 0.76);
  transform: scale(1.04);
}

.video-pane:fullscreen {
  background: black;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.video-pane:fullscreen .video-inner {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.video-pane:fullscreen video {
  max-height: 100%;
  width: auto;
  max-width: 100vw;
  object-fit: contain;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* 커스텀 플레이어 영상에서 브라우저 네이티브 컨트롤 오버레이 완전 제거 */
#slideVideoA::-webkit-media-controls,
#slideVideoA::-webkit-media-controls-enclosure,
#slideVideoA::-webkit-media-controls-panel,
#slideVideoA::-webkit-media-controls-overlay-play-button,
#slideVideoA::-webkit-media-controls-fullscreen-button,
#slideVideoB::-webkit-media-controls,
#slideVideoB::-webkit-media-controls-enclosure,
#slideVideoB::-webkit-media-controls-panel,
#slideVideoB::-webkit-media-controls-overlay-play-button,
#slideVideoB::-webkit-media-controls-fullscreen-button {
  display: none !important;
  -webkit-appearance: none !important;
}

.video-pane:fullscreen #slideVideoB {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  transform: none;
}

.video-pane:fullscreen .custom-controls {
  width: 100%;
  border-radius: 0;
  border: none;
  background: rgba(0, 0, 0, 0.7);
}

body.video-fullscreen-active {
  overflow: hidden;
}

.video-pane.app-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  top: 0;
  width: 100vw;
  height: 100dvh;
  background: black;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.video-pane.app-fullscreen .video-inner {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.video-pane.app-fullscreen video {
  width: auto;
  height: 100%;
  max-width: 100vw;
  max-height: 100%;
  object-fit: contain;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.video-pane.app-fullscreen .custom-controls {
  width: 100%;
  border-radius: 0;
  border: none;
  background: rgba(0, 0, 0, 0.78);
}

.video-pane.mobile-clip-player video {
  pointer-events: none;
}

.video-touch-shield {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.custom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 8px 8px;
}

.video-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px 8px 0;
}

.video-action {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 0;
}

.video-action-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.video-action-icon svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: currentColor;
}

.video-action:hover .video-action-icon {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.video-action.active .video-action-icon {
  color: #ff4d75;
  background: rgba(255, 77, 117, 0.16);
}

#saveAction.active .video-action-icon {
  color: var(--gold);
  background: rgba(230, 181, 74, 0.16);
}

.video-action-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.ctrl-btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  line-height: 1;
  padding: 0;
}

.ctrl-speed-btn {
  width: 24px;
  font-size: 15px;
}

.ctrl-speed-label {
  font-size: 11px;
  color: var(--muted);
  min-width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.ctrl-time {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 72px;
  flex-shrink: 0;
}

.replay-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  z-index: 10;
  border-radius: 8px;
  backdrop-filter: blur(1px);
}

.replay-btn {
  background: rgba(15, 18, 23, 0.82);
  border: 2px solid rgba(230, 181, 74, 0.75);
  color: #fff;
  font-size: 42px;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 1;
  padding: 0;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.45);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.replay-btn:hover {
  background: rgba(230, 181, 74, 0.2);
  border-color: rgba(230, 181, 74, 1);
  transform: scale(1.04);
}

.ctrl-track {
  flex: 1;
  height: 4px;
  background: var(--panel-2);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.ctrl-track:hover { height: 6px; }

.ctrl-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
}

.ctrl-clip {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}

video {
  width: 100%;
  max-height: calc(100vh - 90px);
  aspect-ratio: 9 / 16;
  background: #050607;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.locked-video {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #050607;
  box-shadow: var(--shadow);
}

.locked-video img {
  width: 100%;
  display: block;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  filter: brightness(0.42) saturate(0.85);
}

.lock-layer {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  background: linear-gradient(to bottom, rgba(5, 6, 7, 0.16), rgba(5, 6, 7, 0.72));
}

.lock-layer strong {
  font-family: Georgia, "Times New Roman", serif;
  color: #ffe7a7;
  font-size: 30px;
}

.lock-layer span {
  color: var(--muted);
}

.lock-layer .question-panel {
  width: min(100%, 380px);
  margin: 14px auto 0;
  padding: 14px;
  text-align: left;
  background: rgba(10, 18, 24, 0.78);
  border-color: rgba(101, 183, 231, 0.38);
  backdrop-filter: blur(6px);
}

.lock-layer .question-panel h3 {
  margin-bottom: 5px;
}

.lock-layer .question-panel p {
  font-size: 13px;
}

.lock-layer .question-fields {
  grid-template-columns: 1fr;
}

.lock-layer .question-form textarea {
  min-height: 74px;
}

.word-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.word-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 6vw, 78px);
  line-height: 0.95;
}

.word-subtitle {
  margin-top: 8px;
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 8px;
}

.icon-button {
  min-width: 58px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0 10px;
  font-size: 13px;
}

.icon-button.saved {
  color: var(--gold);
  border-color: rgba(230, 181, 74, 0.7);
}

.definition {
  font-size: 23px;
  line-height: 1.45;
  color: #fff7e6;
  margin-bottom: 22px;
}

.section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 18px;
}

.section h3 {
  font-size: 13px;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  background: var(--panel);
  color: var(--text);
}

.popover-chip {
  position: relative;
  cursor: pointer;
  font: inherit;
}

.root-word-chip {
  border-color: rgba(78, 185, 255, 0.35);
  background: rgba(78, 185, 255, 0.08);
}

.inline-popover {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: none;
  width: max-content;
  max-width: 230px;
  transform: translateX(-50%);
  border: 1px solid rgba(78, 185, 255, 0.42);
  border-radius: 8px;
  padding: 8px 10px;
  background: #111820;
  color: #f4f7fb;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.36);
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
}

.inline-popover::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #111820;
}

.popover-chip.active .inline-popover,
.popover-chip:hover .inline-popover,
.popover-chip:focus-visible .inline-popover {
  display: block;
}

.word-form-chip {
  border: 1px solid rgba(230, 181, 74, 0.24);
  background: rgba(230, 181, 74, 0.05);
}

.word-form-chip > span:first-child {
  color: #fff7e6;
  font-weight: 700;
}

.word-form-chip em {
  color: var(--gold);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  margin-left: 4px;
}

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

.root-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
  text-align: center;
}

.root-card strong {
  display: block;
  color: var(--blue);
  font-size: 25px;
  margin-bottom: 5px;
}

.examples {
  display: grid;
  gap: 10px;
}

.example {
  border-left: 3px solid var(--coral);
  padding: 9px 0 9px 13px;
  color: #e9edf2;
  line-height: 1.45;
}

.script {
  color: var(--muted);
  line-height: 1.55;
  display: grid;
  gap: 9px;
}

.quiz-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-2);
}

.premium-panel {
  border: 1px solid rgba(230, 181, 74, 0.45);
  border-radius: 8px;
  padding: 16px;
  margin-top: 18px;
  background: rgba(230, 181, 74, 0.08);
}

.premium-panel h3 {
  color: var(--gold);
  font-size: 13px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.premium-panel p {
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 13px;
}

.question-panel {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(101, 183, 231, 0.32);
  border-radius: 8px;
  padding: 16px;
  margin-top: 18px;
  background: rgba(101, 183, 231, 0.07);
}

.question-panel h3 {
  color: #d8efff;
  font-size: 13px;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.question-panel p,
.question-status {
  color: var(--muted);
  line-height: 1.45;
}

.question-form {
  display: grid;
  gap: 10px;
}

.question-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.question-form input,
.question-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--panel);
  outline: none;
  padding: 10px 12px;
}

.question-form textarea {
  min-height: 96px;
  resize: vertical;
}

.question-form input:focus,
.question-form textarea:focus {
  border-color: var(--blue);
}

.question-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.question-status {
  font-size: 12px;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.choice {
  min-height: 36px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
}

.choice.correct {
  border-color: var(--green);
  color: #c9f5d5;
  background: rgba(121, 200, 148, 0.12);
}

.choice.wrong {
  border-color: var(--danger);
  color: #f5b8b8;
  background: rgba(212, 87, 87, 0.12);
}

.choices.answered .choice {
  cursor: default;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .sidebar {
    height: auto;
    min-height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .list {
    max-height: 430px;
  }

  .detail {
    height: auto;
    overflow-y: visible;
  }

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

  .video-pane {
    position: static;
    max-width: 420px;
  }

  .video-inner video {
    width: 100% !important;
    max-height: none;
    height: auto;
    margin: 0;
  }
}

@media (max-width: 560px) {
  .sidebar,
  .detail {
    padding: 16px;
  }

  .word-row {
    grid-template-columns: 56px 1fr auto;
  }

  .thumb {
    width: 56px;
    height: 56px;
  }

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

  .question-fields {
    grid-template-columns: 1fr;
  }
}

/* Detail tabs */
.detail-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  margin-bottom: 18px;
}

.detail-tab {
  flex: 1;
  height: 38px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.detail-tab.active {
  background: var(--gold);
  color: #000;
  font-weight: 700;
}

.detail-tab-panel[hidden] { display: none; }

/* Etymology quiz */
.etymology-quiz {
  display: grid;
  gap: 24px;
}

.eq-image-quiz {
  display: grid;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.eq-thumb {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  height: auto;
}

.eq-overlay {
  grid-area: 1 / 1;
  align-self: end;
  padding: 40px 16px 20px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.eq-definition {
  font-size: 20px;
  color: var(--text);
  line-height: 1.5;
  margin: 0;
}

.eq-roots {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.eq-root-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.eq-boxes {
  display: flex;
  gap: clamp(2px, 0.8vw, 4px);
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
}

.eq-box {
  width: clamp(22px, 5vw, 38px);
  height: clamp(28px, 6.5vw, 48px);
  flex-shrink: 0;
  border: 2px solid var(--line);
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--text);
  font-size: clamp(12px, 3vw, 20px);
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  caret-color: transparent;
  outline: none;
  transition: border-color 0.15s;
}

.eq-box:focus { border-color: var(--gold); }
.eq-box.correct { border-color: #4caf50; background: rgba(76,175,80,0.12); color: #4caf50; }
.eq-box.wrong { border-color: #f44336; background: rgba(244,67,54,0.12); animation: shake 0.3s; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.eq-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  justify-content: center;
}

.eq-hint {
  font-size: 16px;
  color: rgba(255,255,255,0.82);
}

.eq-result {
  text-align: center;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
}

.eq-result-word {
  font-size: 28px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 2px;
}

.eq-result-label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.eq-try-again {
  margin-top: 12px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 8px;
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 10;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
}

.account-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.account-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(230, 181, 74, 0.2);
  border: 1px solid rgba(230, 181, 74, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: rgb(230, 181, 74);
  flex-shrink: 0;
}

.account-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.account-email {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  width: fit-content;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-premium {
  background: rgba(230, 181, 74, 0.2);
  color: rgb(230, 181, 74);
  border: 1px solid rgba(230, 181, 74, 0.4);
}

.badge-trial {
  background: rgba(100, 200, 150, 0.15);
  color: rgb(100, 200, 150);
  border: 1px solid rgba(100, 200, 150, 0.3);
}

.badge-free {
  background: rgba(150, 150, 150, 0.15);
  color: var(--muted);
  border: 1px solid var(--line);
}

.account-status-text {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.subscribe-button {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, rgb(230, 181, 74), rgb(200, 150, 40));
  color: #000;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 10px;
  position: relative;
  transition: opacity 0.2s;
}

.subscribe-button:hover {
  opacity: 0.9;
}

.subscribe-icon {
  font-size: 16px;
}

.subscribe-trial {
  font-size: 11px;
  font-weight: 500;
  background: rgba(0,0,0,0.15);
  padding: 2px 7px;
  border-radius: 10px;
}

.free-continue-button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: rgba(232,230,224,0.4);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: color 0.2s;
}

.free-continue-button:hover {
  color: rgba(232,230,224,0.7);
}

.signout-button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.signout-button:hover {
  color: var(--text);
  border-color: var(--text);
}

.comments-section {
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.comments-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.comment-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.comment-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.comment-time {
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
}

.comment-text {
  font-size: 14px;
  color: rgba(232,230,224,0.8);
  margin-top: 4px;
  line-height: 1.5;
}

.no-comments, .comments-signin {
  font-size: 14px;
  color: var(--muted);
  padding: 8px 0;
}

.comment-form {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment-form textarea {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  resize: none;
  font-family: inherit;
}

.comment-form textarea:focus {
  outline: none;
  border-color: rgba(230,181,74,0.5);
}

.comment-form .primary-button {
  align-self: flex-end;
  padding: 8px 20px;
  font-size: 13px;
}

.delete-account-button {
  width: 100%;
  background: transparent;
  border: none;
  color: rgba(232,230,224,0.25);
  font-size: 12px;
  cursor: pointer;
  padding: 6px;
  margin-top: 2px;
  transition: color 0.2s;
}

.delete-account-button:hover {
  color: rgba(220, 80, 80, 0.7);
}
