/* ============================================================
   Random Medical News: MR Edition — Styles
   Newspaper / vintage aesthetic with slot-machine reels
   ============================================================ */

:root {
  --bg: #f5f0e8;
  --bg-dark: #e8e0d0;
  --text: #2c2c2c;
  --text-muted: #6b6b6b;
  --accent: #8b0000;
  --gold: #c8a415;
  --gold-light: #fff8dc;
  --border: #4a4a4a;
  --reel-bg: #fff;
  --reel-border: #333;
  --shadow: rgba(0, 0, 0, 0.15);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --- Sound toggle --- */
.sound-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 100;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.sound-toggle:hover {
  background: var(--bg);
}

/* --- Header --- */
header {
  text-align: center;
  padding: 24px 16px 12px;
  max-width: 800px;
  width: 100%;
}

.header-line {
  height: 3px;
  background: var(--text);
  margin: 8px 0;
}

.title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 900;
  line-height: 1.1;
}

.title-todays {
  display: block;
  font-size: clamp(1rem, 3vw, 1.4rem);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.05em;
}

.title-main {
  display: block;
  font-size: clamp(2rem, 6vw, 3.2rem);
  letter-spacing: -0.02em;
}

.subtitle {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: clamp(0.9rem, 2.5vw, 1.2rem);
  color: var(--accent);
  margin-top: 4px;
  letter-spacing: 0.08em;
}

/* --- Main --- */
main {
  flex: 1;
  width: 100%;
  max-width: 1060px;
  padding: 0 16px 32px;
}

/* --- Tagline --- */
.tagline {
  text-align: center;
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-muted);
  margin: 16px 0 8px;
  letter-spacing: 0.03em;
}

/* --- Reels --- */
.reels-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 24px 0;
  flex-wrap: nowrap;
}

.reel-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.reel-label {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.reel-window {
  width: 280px;
  height: 80px;
  overflow: hidden;
  background: var(--reel-bg);
  border: 3px solid var(--reel-border);
  border-radius: 6px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.2), 2px 2px 6px var(--shadow);
  position: relative;
}

/* Gradient fade at top/bottom edges */
.reel-window::before,
.reel-window::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 12px;
  z-index: 2;
  pointer-events: none;
}
.reel-window::before {
  top: 0;
  background: linear-gradient(to bottom, var(--reel-bg), transparent);
}
.reel-window::after {
  bottom: 0;
  background: linear-gradient(to top, var(--reel-bg), transparent);
}

.reel-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  will-change: transform;
}

.reel-item {
  min-height: 80px;
  height: 80px;
  width: 274px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px 12px;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.25;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  flex-shrink: 0;
}

.reel-item.placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.reel-connector {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--accent);
  width: 80px;
  margin-top: 28px;
  text-align: center;
}

/* --- Spin button --- */
.spin-container {
  text-align: center;
  margin: 20px 0;
}

.spin-btn {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 700;
  padding: 14px 48px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: background 0.2s, transform 0.1s;
  box-shadow: 2px 3px 8px var(--shadow);
}

.spin-btn:hover:not(:disabled) {
  background: #a00000;
  transform: translateY(-1px);
}

.spin-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.spin-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Computing panel --- */
.computing-panel {
  text-align: center;
  padding: 24px;
  margin: 16px 0;
}

.computing-spinner {
  width: 36px;
  height: 36px;
  border: 4px solid var(--bg-dark);
  border-top: 4px solid var(--accent);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.computing-text {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 1rem;
  color: var(--text-muted);
}

/* --- Results panel --- */
.results-panel {
  margin: 20px 0;
  text-align: center;
}

.results-ticker {
  background: var(--text);
  color: #fff;
  padding: 16px 24px;
  border-radius: 4px;
  margin-bottom: 16px;
  animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.headline-text {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1rem, 3vw, 1.4rem);
  font-weight: 700;
  line-height: 1.3;
}

/* Significant result styling */
.results-ticker.significant {
  background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
  border: 3px solid var(--gold);
  box-shadow: 0 0 20px rgba(200, 164, 21, 0.3);
}

.results-ticker.not-significant {
  background: #666;
  opacity: 0.8;
}

.results-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-label {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stat-value {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
}

.results-commentary {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 1rem;
  margin: 16px 0 8px;
  line-height: 1.5;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.results-disclaimer {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 8px;
}

/* --- Share --- */
.share-container {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.share-icon-btn {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background 0.2s, transform 0.1s;
}

.share-icon-btn:hover {
  transform: translateY(-2px);
}

.share-btn-x {
  background: #2c2c2c;
}
.share-btn-x:hover {
  background: #444;
}

.share-btn-bsky {
  background: #0085ff;
}
.share-btn-bsky:hover {
  background: #006acc;
}

/* --- Footer --- */
footer {
  width: 100%;
  text-align: center;
  padding: 24px 16px;
  border-top: 2px solid var(--border);
  margin-top: auto;
}

.footer-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

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

.footer-credit {
  font-size: 0.75rem;
  font-style: italic;
}

.github-link {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
  color: var(--text-muted);
  transition: color 0.2s;
}
.github-link:hover {
  color: var(--text);
}

/* --- Utilities --- */
.hidden {
  display: none !important;
}

/* --- Responsive --- */
@media (max-width: 960px) {
  .reels-container {
    flex-direction: column;
    flex-wrap: wrap;
    gap: 8px;
  }

  .reel-connector {
    margin-top: 0;
    padding: 4px 0;
  }

  .reel-window {
    width: 320px;
  }

  .reel-item {
    width: 314px;
  }

  .results-stats {
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .reel-window {
    width: 280px;
  }

  .reel-item {
    width: 274px;
  }

  .spin-btn {
    font-size: 1.2rem;
    padding: 12px 36px;
  }
}
