:root {
  --ink: #141414;
  --muted: #6b6b6b;
  --line: rgba(20, 20, 20, 0.12);
  --paper: #fafafa;
  --accent: #111111;
  --success: #0f7b59;
  --error: #b3261e;
  --warn: #b06b2c;
  --item-height: 56px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Work Sans", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px 20px 72px;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.maintenance {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  z-index: 20;
  padding: 24px;
}

.maintenance-card {
  text-align: center;
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
  max-width: 420px;
}

.maintenance h1 {
  font-family: "Libre Baskerville", serif;
  font-size: 1.6rem;
  margin: 8px 0 6px;
  color: var(--ink);
}

.maintenance p {
  color: var(--muted);
  line-height: 1.4;
}

.maintenance-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  color: var(--muted);
}

.frame {
  width: min(960px, 100%);
  display: flex;
  flex-direction: column;
  gap: 36px;
  align-items: center;
  text-align: center;
  flex: 1;
  justify-content: center;
}

.read {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.read-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.read-text {
  font-family: "Libre Baskerville", serif;
  font-size: clamp(1.25rem, 3vw, 1.9rem);
  line-height: 1.5;
  color: var(--ink);
}

.read-meta {
  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid rgba(20, 20, 20, 0.08);
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.03);
  text-align: center;
}

.read-actions {
  display: flex;
  gap: 10px;
}

.read-action {
  background: rgba(20, 20, 20, 0.06);
  border: 1px solid rgba(20, 20, 20, 0.08);
  color: rgba(20, 20, 20, 0.65);
  font-size: 0.82rem;
  padding: 6px 12px;
  text-align: center;
  cursor: pointer;
  width: fit-content;
  border-radius: 999px;
}

.read-action:hover {
  color: var(--ink);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
}

.modal-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  max-width: 420px;
  width: 100%;
  padding: 20px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-family: "Libre Baskerville", serif;
  font-size: 1.15rem;
  color: var(--ink);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--muted);
}

.modal-list {
  list-style: disc;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.95rem;
  text-align: left;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}

.reels {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}

.reel-grid {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
  justify-content: center;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior: contain;
}

.reel-grid::-webkit-scrollbar {
  height: 0;
}

.reel-grid::-webkit-scrollbar-thumb {
  background: rgba(20, 20, 20, 0.2);
  border-radius: 999px;
}

.reel {
  position: relative;
  height: calc(var(--item-height) * 3);
  min-width: 172px;
  padding-top: var(--item-height);
  padding-bottom: var(--item-height);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  scroll-snap-align: start;
  cursor: grab;
  user-select: none;
  touch-action: none;
  overscroll-behavior: contain;
}

.reel::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.reel::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  height: var(--item-height);
  border-radius: 12px;
  border: 2px solid rgba(20, 20, 20, 0.35);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 240, 240, 0.94));
  box-shadow:
    inset 0 1px 2px rgba(20, 20, 20, 0.08),
    0 10px 20px rgba(20, 20, 20, 0.06),
    0 0 0 1px rgba(166, 93, 63, 0.12);
  pointer-events: none;
}

.reel::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 8px solid rgba(166, 93, 63, 0.6);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
  pointer-events: none;
}

.reel::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(250, 250, 250, 0.98), rgba(250, 250, 250, 0) 30%, rgba(250, 250, 250, 0) 70%, rgba(250, 250, 250, 0.98));
  pointer-events: none;
}

.reel.locked {
  pointer-events: none;
  opacity: 0.82;
}

.reel:active {
  cursor: grabbing;
}

.reel-inner {
  display: flex;
  flex-direction: column;
}

.reel-item {
  height: var(--item-height);
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  font-family: "Libre Baskerville", serif;
  font-size: clamp(0.95rem, 1.5vw, 1.05rem);
  color: rgba(20, 20, 20, 0.42);
  opacity: 0.9;
  background: linear-gradient(180deg, rgba(20, 20, 20, 0.08), rgba(20, 20, 20, 0.04));
  border-top: 1px solid rgba(20, 20, 20, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
  transition: color 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
  padding: 0 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reel-item.selected {
  color: #0f0f0f;
  font-weight: 700;
  opacity: 1;
  background: linear-gradient(180deg, #ffffff, #f6f6f6);
  border-top: 1px solid rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid rgba(20, 20, 20, 0.22);
  box-shadow:
    inset 0 2px 5px rgba(255, 255, 255, 0.9),
    inset 0 -4px 8px rgba(0, 0, 0, 0.16),
    0 0 0 2px rgba(166, 93, 63, 0.25);
}

.reel-item.hovered {
  color: rgba(20, 20, 20, 0.7);
  opacity: 0.95;
  background: linear-gradient(180deg, rgba(20, 20, 20, 0.16), rgba(20, 20, 20, 0.08));
}

.reel-item.correct {
  color: var(--success);
  outline: 1px solid rgba(15, 123, 89, 0.35);
  background: linear-gradient(180deg, rgba(15, 123, 89, 0.14), rgba(15, 123, 89, 0.04));
}

.reel-item.incorrect {
  color: var(--error);
  outline: 1px solid rgba(179, 38, 30, 0.35);
  background: linear-gradient(180deg, rgba(179, 38, 30, 0.12), rgba(179, 38, 30, 0.04));
}

.reel.focused {
  box-shadow: 0 0 0 2px rgba(20, 20, 20, 0.16);
}

.reel.snap {
  animation: snap 140ms ease-out;
}

@keyframes snap {
  0% {
    transform: scale(1);
  }
  60% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

.actions {
  display: flex;
  justify-content: center;
}

.submit {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.submit:active {
  transform: translateY(1px);
}

.share-button {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(20, 20, 20, 0.2);
  border-radius: 999px;
  padding: 0.55rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.share-button:active {
  transform: translateY(1px);
}

.share-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.floating-controls {
  position: fixed;
  right: 16px;
  bottom: 72px;
  display: flex;
  gap: 10px;
  z-index: 12;
}

.pill-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(20, 20, 20, 0.12);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pill-btn:active {
  transform: translateY(1px);
}

.result {
  font-size: 0.95rem;
  color: var(--muted);
  text-align: center;
  min-height: 1.4em;
}

.result.success {
  color: var(--success);
}

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

.answer {
  border-top: 2px solid rgba(20, 20, 20, 0.12);
  padding-top: 14px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  min-height: 3.2rem;
}


.read-meaning.hidden,
.result.hidden,
.answer.hidden {
  display: block !important;
  visibility: hidden;
}

.answer-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(20, 20, 20, 0.5);
  font-weight: 700;
}

#answer-idiom {
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
}

.answer.success {
  border-top-color: rgba(15, 123, 89, 0.6);
}

.answer.success .answer-label {
  color: rgba(15, 123, 89, 0.75);
}

.answer.error {
  border-top-color: rgba(179, 38, 30, 0.6);
}

.answer.error .answer-label {
  color: rgba(179, 38, 30, 0.75);
}

.footer {
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-top: 28px;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
  width: 100%;
  text-align: center;
}

.footer a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.footer-dot {
  opacity: 0.5;
}

@media (max-width: 680px) {
  body {
    padding: 32px 16px 48px;
  }

  .reel {
    min-width: 124px;
  }

  .reel-grid {
    gap: 12px;
  }

  .footer {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  :root {
    --item-height: 42px;
  }

  body {
    padding: 24px 14px 40px;
  }

  .frame {
    gap: 26px;
  }

  .read-text {
    font-size: clamp(1.1rem, 5vw, 1.5rem);
  }

  .read-meaning {
    font-size: 0.88rem;
  }

  .reel {
    min-width: 112px;
  }

  .reel-grid {
    gap: 8px;
  }

  .submit {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }

  .share-button {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }
}
