/* ==========================================================================
   韓運字 — Component Styles
   ========================================================================== */

/* ---------- Glass card ---------- */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.glass-card-inset {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}

.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--gold-gradient);
  color: #241a00;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost {
  background: var(--glass-bg);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}
.btn-ghost:hover { background: var(--glass-bg-strong); }
.btn-sm { padding: 8px 14px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Feature card (home grid) ---------- */
.feature-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.feature-card:hover { transform: translateY(-3px); border-color: rgba(249,202,36,0.4); }
.feature-card .fc-icon { font-size: 26px; }
.feature-card .fc-title { font-weight: 700; font-size: 13.5px; }
.feature-card .fc-desc { font-size: 11px; color: var(--text-secondary); line-height: 1.4; }
.feature-card .fc-badge {
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(249,202,36,0.15);
  color: var(--gold-1);
}

/* ---------- Ohaeng chips / tags ---------- */
.oh-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.oh-wood { color: var(--oh-wood); background: rgba(45,212,168,0.12); }
.oh-fire { color: var(--oh-fire); background: rgba(255,71,87,0.12); }
.oh-earth { color: var(--oh-earth); background: rgba(255,165,2,0.12); }
.oh-metal { color: var(--oh-metal); background: rgba(223,230,233,0.12); }
.oh-water { color: var(--oh-water); background: rgba(55,66,250,0.15); }

.oh-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.oh-dot.oh-wood { background: var(--oh-wood); }
.oh-dot.oh-fire { background: var(--oh-fire); }
.oh-dot.oh-earth { background: var(--oh-earth); }
.oh-dot.oh-metal { background: var(--oh-metal); }
.oh-dot.oh-water { background: var(--oh-water); }

/* ---------- Radar chart ---------- */
.radar-wrap { display: flex; justify-content: center; padding: 10px 0; }
.radar-wrap svg { max-width: 280px; width: 100%; height: auto; overflow: visible; }
.radar-grid { fill: none; stroke: var(--glass-border); stroke-width: 1; }
.radar-axis { stroke: var(--glass-border); stroke-width: 1; }
.radar-shape { fill: rgba(249,202,36,0.25); stroke: var(--gold-1); stroke-width: 2; filter: drop-shadow(0 0 6px rgba(249,202,36,0.5)); }
.radar-label { font-size: 11px; fill: var(--text-secondary); font-family: var(--font-jp); }

/* ---------- 3D flip card ---------- */
.flip-scene { perspective: 1200px; }
.flip-card {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(.2,.8,.2,1);
  cursor: pointer;
}
.flip-card.flipped { transform: rotateY(180deg); }
.flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  border: 1px solid var(--glass-border);
}
.flip-front {
  background: linear-gradient(160deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
}
.flip-front .fc-glyph { font-size: 34px; margin-bottom: 6px; }
.flip-back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, rgba(249,202,36,0.14), rgba(0,0,0,0.3));
}
.flip-back .word-kr { font-family: var(--font-kr-serif); font-size: 22px; margin-bottom: 4px; }
.flip-back .word-jp { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }
.flip-back .word-ex { font-size: 10.5px; color: var(--text-muted); line-height: 1.5; }

/* ---------- Word grid ---------- */
.word-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }

/* ---------- Dial UI (destiny dial) ---------- */
.dial-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 18px; margin: 20px 0; }
.dial-unit { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dial-ring {
  position: relative;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid var(--glass-border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  user-select: none;
}
.dial-ring .dial-face { font-size: 30px; transition: transform 0.5s cubic-bezier(.2,.8,.2,1); }
.dial-ring.spinning .dial-face { animation: dial-spin 0.7s cubic-bezier(.3,.7,.3,1); }
.dial-name { font-size: 12px; color: var(--text-secondary); font-weight: 700; }
.dial-value { font-size: 13px; color: var(--gold-1); font-weight: 700; }

/* ---------- Progress / gauge ---------- */
.gauge-track { width: 100%; height: 14px; border-radius: 10px; background: rgba(255,255,255,0.08); overflow: hidden; border: 1px solid var(--glass-border); }
.gauge-fill { height: 100%; border-radius: 10px; background: var(--gold-gradient); transition: width 0.4s ease; }
.gauge-fill.charge { background: linear-gradient(90deg, var(--oh-water), var(--oh-wood), var(--gold-1)); }

.streak-row { display: flex; gap: 6px; flex-wrap: wrap; }
.streak-dot { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,0.08); border: 1px solid var(--glass-border); }
.streak-dot.done { background: var(--gold-gradient); box-shadow: 0 0 8px rgba(249,202,36,0.6); border-color: transparent; }

/* ---------- Stamp calendar (21 days) ---------- */
.stamp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin: 16px 0; }
.stamp-day {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  position: relative;
}
.stamp-day.filled { color: var(--text-primary); border-color: rgba(249,202,36,0.4); }
.stamp-day.filled .stamp-mark { font-size: 16px; }
.stamp-day.today { box-shadow: 0 0 0 2px var(--gold-1) inset; }

/* ---------- Canvas containers ---------- */
.canvas-frame {
  display: flex;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}
.canvas-frame canvas { max-width: 100%; border-radius: 12px; }

/* ---------- Layout helpers ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.tab-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}
.tab-btn.active { background: var(--gold-gradient); color: #241a00; border-color: transparent; }

.tooltip-word {
  border-bottom: 1px dashed var(--gold-1);
  cursor: help;
  position: relative;
  color: var(--gold-1);
}
.tooltip-word .tooltip-bubble {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1f38;
  border: 1px solid var(--glass-border);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  white-space: nowrap;
  color: var(--text-primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 10;
}
.tooltip-word:hover .tooltip-bubble { opacity: 1; }

.diary-entry { padding: 12px 14px; border-bottom: 1px solid var(--glass-border); }
.diary-entry:last-child { border-bottom: none; }
.diary-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }

/* ---------- Toast ---------- */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: var(--shadow-card);
  max-width: 280px;
}
