/* =============================================
   Etymology / Origin Sheet Styles
   ============================================= */

/* ── Modal Overlay ── */
#etymology-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.55);
  align-items: flex-end;
}
#etymology-modal.open {
  display: flex;
}

/* ── Sheet ── */
#etymology-sheet {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  background: #1E1E3A;
  border-radius: 20px 20px 0 0;
  padding: 0 20px 32px;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.34, 1.3, 0.64, 1);
  max-height: 82vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#etymology-modal.open #etymology-sheet {
  transform: translateY(0);
}

/* ── Handle ── */
#etymology-sheet .modal-handle {
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  margin: 12px auto 16px;
}

/* ── Header row ── */
.etym-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

/* ── Type Badge ── */
.etym-type-badge {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1.5px solid currentColor;
}
.etym-type-badge.type-pictographic  { color: #FFD700; border-color: #FFD700; background: rgba(255,215,0,0.12); }
.etym-type-badge.type-indicative    { color: #4ECDC4; border-color: #4ECDC4; background: rgba(78,205,196,0.12); }
.etym-type-badge.type-compound      { color: #6BCB77; border-color: #6BCB77; background: rgba(107,203,119,0.12); }
.etym-type-badge.type-phonosemantic { color: #C3B1E1; border-color: #C3B1E1; background: rgba(195,177,225,0.12); }
.etym-type-badge.type-simplified    { color: #FF8C69; border-color: #FF8C69; background: rgba(255,140,105,0.12); }

/* ── Char Row ── */
.etym-char-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.etym-char {
  font-size: 64px;
  line-height: 1;
  color: #fff;
  font-family: serif;
  flex-shrink: 0;
}
.etym-char-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.etym-pinyin {
  font-size: 20px;
  color: #FFE66D;
  font-weight: 600;
}
.etym-meaning {
  font-size: 14px;
  color: rgba(255,255,255,0.65);
}

/* ── Visual Strip (pictographic) ── */
.etym-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 16px 12px;
  margin-bottom: 18px;
}
.etym-visual.hidden { display: none; }

.etym-vis-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.etym-vis-item {
  font-size: 36px;
  line-height: 1;
  min-width: 48px;
  text-align: center;
}
.etym-ancient-glyph {
  font-size: 28px;
  color: #c8a86b;
  font-style: italic;
  letter-spacing: -0.02em;
}
.etym-modern-glyph {
  font-size: 36px;
  color: #FFD700;
  font-family: serif;
}
.etym-vis-label {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.etym-arrow {
  font-size: 20px;
  color: rgba(255,255,255,0.3);
  flex-shrink: 0;
  margin-bottom: 18px;
}

/* ── Component Pills ── */
.etym-components {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
.etym-components.hidden { display: none; }

.etym-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 14px;
  border-radius: 12px;
  min-width: 64px;
}
.etym-pill.meaning {
  background: rgba(255,140,0,0.18);
  border: 1.5px solid rgba(255,140,0,0.5);
}
.etym-pill.sound {
  background: rgba(78,205,255,0.14);
  border: 1.5px solid rgba(78,205,255,0.45);
}
.etym-pill-char {
  font-size: 26px;
  color: #fff;
  font-family: serif;
}
.etym-pill-gloss {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}
.etym-pill-role {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.etym-pill.meaning .etym-pill-role { color: #FF8C00; }
.etym-pill.sound   .etym-pill-role { color: #4ECDF0; }

.etym-plus {
  font-size: 20px;
  color: rgba(255,255,255,0.3);
  margin: 0 2px;
}

/* ── Story ── */
.etym-story {
  font-size: 15px;
  line-height: 1.65;
  color: rgba(255,255,255,0.82);
  margin: 0 0 20px;
  text-align: left;
}

/* ── Close Button ── */
#etym-close-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
#etym-close-btn:active {
  background: rgba(255,255,255,0.18);
}

/* ── Origin Buttons ── */
.btn-origin {
  background: rgba(255, 215, 0, 0.15);
  color: #FFD700;
  border: 1.5px solid rgba(255, 215, 0, 0.4);
}
.btn-origin:active {
  background: rgba(255, 215, 0, 0.28);
}

.btn-origin-success {
  background: rgba(255,215,0,0.18);
  color: #FFD700;
  border: 2px solid rgba(255,215,0,0.5);
  font-size: 16px;
  font-weight: 700;
  padding: 14px 24px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  margin-bottom: 10px;
}
.btn-origin-success:active {
  background: rgba(255,215,0,0.32);
}
