/* Card Deck Engine — Shared styles for scrollable card-based lessons */
:root {
  --accent: #f39c12;
  --accent-rgb: 243,156,18;
  --bg: #0f0f1e;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg); color: white;
  -webkit-font-smoothing: antialiased;
  overflow: hidden; height: 100dvh;
}

/* Progress bar */
.progress-track { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: rgba(255,255,255,0.06); z-index: 200; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #e74c3c); transition: width 0.3s; width: 0%; }

/* Top bar */
.top-bar {
  position: fixed; top: 3px; left: 0; right: 0; z-index: 200;
  padding: 10px 16px; display: flex; justify-content: space-between; align-items: center;
  background: rgba(15,15,30,0.85); backdrop-filter: blur(10px);
}
.top-bar a { color: rgba(255,255,255,0.4); text-decoration: none; font-size: 14px; }
.top-bar a:hover { color: white; }
.top-bar .deck-title { font-size: 13px; color: rgba(255,255,255,0.3); text-transform: uppercase; letter-spacing: 1px; }
.top-bar .card-counter { font-size: 13px; color: rgba(255,255,255,0.3); }

/* View dots */
.view-dots { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; gap: 6px; transition: opacity 0.3s; }
.view-dots.hidden { opacity: 0; pointer-events: none; }
.view-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.15); transition: all 0.3s; }
.view-dot.active { background: var(--accent); width: 20px; border-radius: 4px; }
.view-dot-label { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); font-size: 10px; color: rgba(255,255,255,0.2); text-transform: uppercase; letter-spacing: 1px; z-index: 200; }

/* Vertical deck */
.deck { scroll-snap-type: y mandatory; overflow-y: scroll; overflow-x: hidden; height: 100dvh; scroll-behavior: smooth; }

/* Card */
.card { scroll-snap-align: start; height: 100dvh; position: relative; overflow: hidden; }
.card-track { display: flex; width: 300%; height: 100%; transition: transform 0.35s cubic-bezier(0.25, 0.1, 0.25, 1); }
.card-track.dragging { transition: none; }

/* View within a card */
.card-view { width: 100vw; height: 100%; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 24px 50px; overflow-y: auto; }
.card-inner { max-width: 440px; width: 100%; }

/* Swipe hint arrows */
.swipe-hint-left, .swipe-hint-right {
  position: absolute; top: 50%; z-index: 10;
  font-size: 28px; color: rgba(255,255,255,0.08);
  transition: all 0.2s; cursor: pointer; pointer-events: auto;
  width: 36px; height: 60px; display: flex; align-items: center; justify-content: center; border-radius: 8px;
}
.swipe-hint-left { left: 4px; transform: translateY(-50%); }
.swipe-hint-right { right: 4px; transform: translateY(-50%); }
.swipe-hint-left:hover, .swipe-hint-right:hover { color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.05); }

/* View badges */
.view-badge { display: inline-block; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700; padding: 4px 10px; border-radius: 6px; margin-bottom: 12px; }
.view-badge.learn { background: rgba(var(--accent-rgb), 0.12); color: var(--accent); }
.view-badge.explore { background: rgba(93,173,226,0.12); color: #5dade2; }
.view-badge.practice { background: rgba(39,174,96,0.12); color: #27ae60; }

/* Content typography */
.card h2 { font-size: 24px; font-weight: 800; margin-bottom: 12px; line-height: 1.2; }
.card h2 .accent { color: var(--accent); }
.card p { font-size: 15px; color: #bbb; line-height: 1.7; margin-bottom: 16px; }
.card p strong { color: white; }
.card .small { font-size: 13px; color: #666; }
.emoji { font-size: 48px; margin-bottom: 16px; text-align: center; }

/* Math display */
.math { font-family: 'Times New Roman', Georgia, serif; font-size: 26px; font-weight: 700; color: white; text-align: center; padding: 20px; background: rgba(255,255,255,0.04); border-radius: 12px; margin: 16px 0; }
.math .hl { color: var(--accent); }
.math .hl2 { color: #e74c3c; }
.math .hl3 { color: #27ae60; }
.math .hl4 { color: #5dade2; }
.math .big { font-size: 32px; }

/* Connection callout */
.connection { padding: 14px 16px; border-radius: 10px; margin: 12px 0; background: rgba(var(--accent-rgb), 0.06); border-left: 3px solid rgba(var(--accent-rgb), 0.3); font-size: 14px; color: #ccc; line-height: 1.6; }
.connection .conn-label { font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; margin-bottom: 4px; }

/* Step rows (toggleable blur/reveal) */
.steps { margin: 12px 0; }
.step-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.04); cursor: pointer; transition: opacity 0.3s; }
.step-row .step-num { width: 24px; height: 24px; border-radius: 50%; background: rgba(var(--accent-rgb), 0.15); color: var(--accent); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.step-row .step-content { font-size: 15px; color: #bbb; font-family: 'Times New Roman', Georgia, serif; }
.step-row .step-content .hl { color: var(--accent); font-weight: 700; }
.step-row.hidden .step-content { filter: blur(6px); color: #444; }
.step-row.hidden .step-num { background: rgba(255,255,255,0.05); color: #444; }

/* Sliders */
.slider-row { margin: 12px 0; }
.slider-row label { display: flex; justify-content: space-between; font-size: 13px; color: #888; margin-bottom: 6px; }
.slider-row label .sv { color: var(--accent); font-weight: 700; font-family: 'Times New Roman', serif; font-size: 16px; }
.slider-row input[type="range"] { -webkit-appearance: none; width: 100%; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.1); outline: none; }
.slider-row input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--bg); }
.live-result { font-family: 'Times New Roman', Georgia, serif; font-size: 20px; text-align: center; color: white; padding: 14px; background: rgba(255,255,255,0.03); border-radius: 10px; margin-top: 8px; }

/* Try-it / practice blocks */
.try-it { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 14px; padding: 20px; margin: 16px 0; }
.try-it .try-label { font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700; margin-bottom: 10px; }
.try-it .problem { font-family: 'Times New Roman', Georgia, serif; font-size: 22px; text-align: center; margin-bottom: 12px; color: white; }
.try-it input { width: 100%; padding: 10px 14px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.04); color: white; font-family: 'Times New Roman', Georgia, serif; font-size: 18px; text-align: center; outline: none; }
.try-it input:focus { border-color: var(--accent); }
.try-it .feedback { text-align: center; margin-top: 10px; font-size: 14px; font-weight: 600; min-height: 20px; }
.try-it .feedback.correct { color: #27ae60; }
.try-it .feedback.wrong { color: #e74c3c; }
.try-it .reveal-btn { display: block; margin: 10px auto 0; padding: 8px 20px; border-radius: 8px; border: none; font-size: 13px; font-weight: 600; background: rgba(255,255,255,0.06); color: #888; cursor: pointer; }
.try-it .reveal-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.try-it .solution { text-align: center; margin-top: 10px; font-size: 15px; color: #888; font-family: 'Times New Roman', Georgia, serif; display: none; }
.try-it .solution.show { display: block; }

/* Scroll hint */
.scroll-hint { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); font-size: 12px; color: rgba(255,255,255,0.15); animation: pulse 2s ease infinite; }
@keyframes pulse { 0%,100% { opacity: 0.15; } 50% { opacity: 0.3; } }

/* 3D container */
.three-container { width: 100%; height: 50vh; border-radius: 12px; overflow: hidden; margin: 12px 0; position: relative; }
.three-container canvas { width: 100% !important; height: 100% !important; }

/* Area model grid */
.area-model { display: grid; grid-template-columns: auto 1fr 1fr; gap: 0; margin: 16px 0; border-radius: 12px; overflow: hidden; font-family: 'Times New Roman', Georgia, serif; font-size: 20px; font-weight: 700; }
.area-model .corner { background: rgba(255,255,255,0.02); padding: 12px 16px; color: #444; }
.area-model .col-head { padding: 12px 16px; text-align: center; color: var(--accent); background: rgba(var(--accent-rgb), 0.08); }
.area-model .row-head { padding: 12px 16px; color: #e74c3c; background: rgba(231,76,60,0.08); }
.area-model .cell { padding: 16px; text-align: center; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.04); }
.area-model .cell.f { color: #27ae60; background: rgba(39,174,96,0.06); }
.area-model .cell.o { color: #5dade2; background: rgba(93,173,226,0.06); }
.area-model .cell.i { color: #e74c3c; background: rgba(231,76,60,0.06); }
.area-model .cell.l { color: var(--accent); background: rgba(var(--accent-rgb), 0.06); }

/* Rectangle visualization */
.rect-scene { position: relative; width: 100%; aspect-ratio: 1.2; max-width: 340px; margin: 12px auto; }
.rect-box {
  position: absolute; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Times New Roman', Georgia, serif; font-weight: 700; font-size: 14px;
  transition: all 0.4s cubic-bezier(0.25, 0.1, 0.25, 1); overflow: hidden;
}
.rect-box .area-label { text-shadow: 0 1px 3px rgba(0,0,0,0.5); transition: opacity 0.3s; }
.rect-f { background: rgba(39,174,96,0.25); border: 2px solid rgba(39,174,96,0.5); color: #27ae60; }
.rect-o { background: rgba(93,173,226,0.25); border: 2px solid rgba(93,173,226,0.5); color: #5dade2; }
.rect-i { background: rgba(231,76,60,0.25); border: 2px solid rgba(231,76,60,0.5); color: #e74c3c; }
.rect-l { background: rgba(var(--accent-rgb),0.25); border: 2px solid rgba(var(--accent-rgb),0.5); color: var(--accent); }
@keyframes glow { 0%,100% { box-shadow: 0 0 0 transparent; } 50% { box-shadow: 0 0 20px rgba(255,255,255,0.15); } }
.rect-box.pulse { animation: glow 1.5s ease infinite; }

/* Rect side labels */
.rect-label-top, .rect-label-left {
  position: absolute; font-family: 'Times New Roman', Georgia, serif;
  font-size: 13px; font-weight: 700; transition: all 0.4s; text-align: center;
}
.rect-label-top { color: var(--accent); }
.rect-label-left { color: #e74c3c; }

/* Total area display */
.total-area {
  text-align: center; font-family: 'Times New Roman', Georgia, serif;
  font-size: 20px; font-weight: 700; color: white; padding: 12px;
  background: rgba(255,255,255,0.04); border-radius: 10px; margin-top: 10px; transition: all 0.4s;
}

/* Animated text reveal */
.anim-text { opacity: 0; transform: translateY(12px); transition: all 0.6s cubic-bezier(0.25, 0.1, 0.25, 1); }
.anim-text.visible { opacity: 1; transform: translateY(0); }

/* Big friendly slider */
.x-slider-wrap { text-align: center; margin: 12px 0; }
.x-slider-label { font-size: 14px; color: #888; margin-bottom: 6px; }
.x-slider-label .x-val { font-family: 'Times New Roman', Georgia, serif; font-size: 26px; font-weight: 800; color: white; display: inline-block; min-width: 36px; }
.x-slider { -webkit-appearance: none; width: 100%; height: 8px; border-radius: 4px; background: rgba(255,255,255,0.1); outline: none; }
.x-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 32px; height: 32px; border-radius: 50%; background: white; cursor: pointer; border: 3px solid var(--bg); box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
