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

:root {
  --bg: #0e0c0a;
  --surface: #171410;
  --card: #1e1a15;
  --border: rgba(255,220,140,0.12);
  --border-hi: rgba(255,220,140,0.35);
  --gold: #f0c060;
  --gold-dim: #a07830;
  --cream: #f5ead0;
  --cream-dim: #8a7d65;
  --rust: #c0522a;
  --sage: #4a7a5a;
  --sage-light: #6aaa7a;
  --text: #e8dcc8;
  --text-dim: #6a5e4a;
  --drop-active: rgba(240,192,96,0.15);
  --drop-border: rgba(240,192,96,0.6);
}

body {
  font-family: 'Lora', Georgia, serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background-image:
    radial-gradient(ellipse 70% 50% at 15% 20%, rgba(240,192,96,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 50% 70% at 85% 80%, rgba(192,82,42,0.05) 0%, transparent 60%);
  pointer-events: none;
}

.wrap { position: relative; z-index: 1; max-width: 860px; margin: 0 auto; padding: 0 1.2rem 4rem; }

/* ── HEADER ── */
header {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  display: flex; justify-content: space-between; align-items: flex-end;
}
.brand {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  color: var(--gold);
  line-height: 1;
}
.brand span { font-style: italic; color: var(--cream); }
.hud { display: flex; gap: 1.2rem; align-items: center; }
.hud-item {
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  padding: .5rem .9rem;
  min-width: 64px;
}
.hud-val {
  font-family: 'DM Mono', monospace;
  font-size: 1.3rem; font-weight: 500;
  color: var(--gold);
  display: block;
}
.hud-lbl { font-size: .65rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); }

/* ── MODE TABS ── */
.mode-tabs {
  display: flex; gap: .5rem; margin-bottom: 2rem;
}
.mode-tab {
  padding: .45rem 1.2rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
  font-size: .75rem; letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer; transition: all .2s;
}
.mode-tab.active {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
}
.mode-tab:not(.active):hover { border-color: var(--border-hi); color: var(--cream); }

/* ── PROGRESS ── */
.progress-row {
  display: flex; align-items: center; gap: 1rem; margin-bottom: 1.8rem;
}
.prog-bar {
  flex: 1; height: 2px;
  background: var(--border);
  position: relative; overflow: hidden;
}
.prog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.prog-label { font-family: 'DM Mono', monospace; font-size: .75rem; color: var(--text-dim); white-space: nowrap; }

/* ── GAME CARD ── */
.game-card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 2rem 2.2rem;
  position: relative;
  animation: rise .45s ease both;
}
.game-card::before {
  content: '';
  position: absolute; top: 0; left: 2rem; right: 2rem; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

@keyframes rise { from { opacity:0; transform: translateY(16px); } to { opacity:1; transform: none; } }

/* philosopher badge */
.phil-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.4rem; }
.phil-badge {
  display: flex; align-items: center; gap: .6rem;
}
.phil-icon {
  width: 38px; height: 38px;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.phil-name { font-family: 'DM Serif Display', serif; font-size: 1.1rem; color: var(--cream); }
.phil-era { font-size: .75rem; color: var(--text-dim); font-style: italic; }
.concept-pill {
  font-family: 'DM Mono', monospace; font-size: .7rem; letter-spacing: .1em;
  text-transform: uppercase; padding: .3rem .8rem;
  background: rgba(74,122,90,0.2); border: 1px solid var(--sage);
  color: var(--sage-light);
}

/* ── MODE A: DRAG & DROP ── */
.doctrine-sentence {
  font-family: 'Lora', serif; font-size: 1.15rem; line-height: 1.9;
  color: var(--text); margin-bottom: 1.6rem;
  border-left: 2px solid var(--gold-dim);
  padding-left: 1.2rem;
}
.doctrine-sentence em { font-style: italic; color: var(--cream-dim); }

.drop-zone {
  display: inline-flex; align-items: center;
  min-width: 120px; height: 34px;
  border-bottom: 2px dashed var(--gold-dim);
  padding: 0 .5rem;
  margin: 0 .2rem;
  vertical-align: middle;
  position: relative;
  transition: all .2s;
  cursor: pointer;
}
.drop-zone.drag-over {
  background: var(--drop-active);
  border-bottom-color: var(--gold);
  border-bottom-style: solid;
}
.drop-zone.filled {
  border-bottom-color: var(--sage);
  border-bottom-style: solid;
  background: rgba(74,122,90,0.1);
}
.drop-zone.filled.wrong {
  border-bottom-color: var(--rust);
  background: rgba(192,82,42,0.1);
}
.drop-zone .placed-word {
  font-family: 'DM Mono', monospace; font-size: .9rem;
  color: var(--sage-light); font-weight: 500;
  white-space: nowrap;
}
.drop-zone.wrong .placed-word { color: #e08060; }
.drop-placeholder { font-family: 'DM Mono', monospace; font-size: .75rem; color: var(--text-dim); }

.word-bank {
  display: flex; flex-wrap: wrap; gap: .6rem;
  margin-top: 1.2rem; padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}
.word-chip {
  font-family: 'DM Mono', monospace; font-size: .85rem;
  padding: .4rem .9rem;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  color: var(--cream);
  cursor: grab;
  user-select: none;
  transition: all .2s;
  touch-action: none;
}
.word-chip:hover { background: rgba(240,192,96,0.1); border-color: var(--gold); color: var(--gold); }
.word-chip.dragging { opacity: .3; cursor: grabbing; }
.word-chip.used { opacity: .25; pointer-events: none; }

/* ── MODE B: ADIVINA AL FILÓSOFO ── */
.guess-container { }
.hint-list { display: flex; flex-direction: column; gap: .8rem; margin-bottom: 1.5rem; }
.hint-item {
  display: flex; gap: .9rem; align-items: flex-start;
  padding: .8rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.hint-item.locked {
  opacity: .4; filter: blur(1px);
  pointer-events: none;
}
.hint-item.revealed { animation: revealHint .4s ease both; }
@keyframes revealHint { from { opacity:.4; transform: translateX(-6px); } to { opacity:1; transform:none; } }

.hint-num {
  font-family: 'DM Mono', monospace; font-size: .7rem;
  color: var(--gold); background: rgba(240,192,96,0.1);
  border: 1px solid var(--gold-dim);
  padding: .2rem .5rem; flex-shrink: 0; margin-top: .1rem;
}
.hint-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); margin-bottom: .3rem; }
.hint-text { font-size: 1rem; color: var(--cream); line-height: 1.5; }
.hint-pts { font-family: 'DM Mono', monospace; font-size: .7rem; color: var(--gold); margin-left: auto; flex-shrink: 0; }

.reveal-btn {
  background: transparent;
  border: 1px solid var(--border-hi);
  color: var(--gold);
  font-family: 'DM Mono', monospace;
  font-size: .75rem; letter-spacing: .08em; text-transform: uppercase;
  padding: .5rem 1.2rem; cursor: pointer;
  transition: all .2s; margin-right: .6rem;
}
.reveal-btn:hover { background: rgba(240,192,96,0.1); border-color: var(--gold); }
.reveal-btn:disabled { opacity: .3; pointer-events: none; }

/* ── PHILOSOPHER OPTIONS ── */
.phil-options {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(0,1fr));
  gap: .5rem; margin-top: 1rem;
}
.phil-opt {
  padding: .6rem .5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--cream-dim);
  font-family: 'Lora', serif; font-size: .9rem; text-align: center;
  cursor: pointer; transition: all .2s;
}
.phil-opt:hover { border-color: var(--gold); color: var(--cream); background: rgba(240,192,96,0.08); }
.phil-opt.correct { background: rgba(74,122,90,0.25); border-color: var(--sage-light); color: var(--sage-light); }
.phil-opt.wrong { background: rgba(192,82,42,0.2); border-color: #a04020; color: #e08060; }
.phil-opt:disabled { pointer-events: none; }

/* ── FEEDBACK ── */
.feedback {
  margin-top: 1.2rem;
  padding: .9rem 1.1rem;
  border-left: 3px solid var(--gold);
  background: rgba(240,192,96,0.06);
  font-size: .95rem; color: var(--cream-dim);
  line-height: 1.6;
  display: none;
}
.feedback.show { display: block; animation: rise .3s ease; }
.feedback b { color: var(--gold); }

/* ── ACTIONS ── */
.actions {
  display: flex; align-items: center; gap: .8rem;
  margin-top: 1.5rem; padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.btn-check {
  background: var(--gold);
  color: var(--bg); border: none;
  font-family: 'DM Mono', monospace;
  font-size: .8rem; letter-spacing: .1em; text-transform: uppercase;
  padding: .65rem 1.8rem; cursor: pointer; transition: all .2s;
}
.btn-check:hover { background: #f8d080; transform: translateY(-1px); }
.btn-check:disabled { opacity: .4; pointer-events: none; }
.btn-next {
  background: transparent; border: 1px solid var(--border-hi);
  color: var(--cream); font-family: 'DM Mono', monospace;
  font-size: .8rem; letter-spacing: .1em; text-transform: uppercase;
  padding: .65rem 1.8rem; cursor: pointer; transition: all .2s; display: none;
}
.btn-next:hover { border-color: var(--gold); color: var(--gold); }
.btn-next.show { display: inline-block; }
.btn-clear {
  background: transparent; border: none;
  color: var(--text-dim); font-family: 'DM Mono', monospace;
  font-size: .75rem; cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px; margin-left: auto;
}
.btn-clear:hover { color: var(--rust); }

/* ── RESULT SCREEN ── */
#screen-result {
  display: none; text-align: center; padding: 4rem 2rem;
  animation: rise .6s ease;
}
.result-big { font-family: 'DM Serif Display', serif; font-size: 5rem; color: var(--gold); line-height: 1; }
.result-title { font-family: 'DM Serif Display', serif; font-size: 2rem; color: var(--cream); margin: .5rem 0; }
.result-sub { color: var(--text-dim); font-style: italic; margin-bottom: 2rem; }
.result-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: .8rem; max-width: 460px; margin: 0 auto 2rem; }
.r-cell { background: var(--card); border: 1px solid var(--border); padding: 1rem; }
.r-val { font-family: 'DM Mono', monospace; font-size: 1.6rem; color: var(--gold); display: block; }
.r-lbl { font-size: .7rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em; }
.btn-replay {
  background: var(--gold); color: var(--bg); border: none;
  font-family: 'DM Mono', monospace; font-size: .85rem;
  letter-spacing: .1em; text-transform: uppercase;
  padding: .8rem 2.5rem; cursor: pointer; transition: all .2s;
}
.btn-replay:hover { background: #f8d080; transform: translateY(-2px); }

/* START SCREEN */
#screen-start {
  text-align: center; padding: 4rem 1.5rem;
  animation: rise .6s ease;
}
.start-title { font-family: 'DM Serif Display', serif; font-size: clamp(2rem,6vw,3.5rem); color: var(--gold); margin-bottom: .4rem; }
.start-subtitle { font-family: 'DM Serif Display', serif; font-style: italic; font-size: 1.1rem; color: var(--cream-dim); margin-bottom: 2rem; }
.mode-explainer {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; max-width: 560px; margin: 0 auto 2.5rem; text-align: left;
}
.mode-ex {
  background: var(--card); border: 1px solid var(--border); padding: 1.1rem 1.2rem;
}
.mode-ex-title { font-family: 'DM Mono', monospace; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); margin-bottom: .4rem; }
.mode-ex-desc { font-size: .85rem; color: var(--text-dim); line-height: 1.5; }
.btn-go {
  background: var(--gold); color: var(--bg); border: none;
  font-family: 'DM Mono', monospace; font-size: .9rem;
  letter-spacing: .12em; text-transform: uppercase;
  padding: .85rem 3rem; cursor: pointer; transition: all .2s;
}
.btn-go:hover { background: #f8d080; transform: translateY(-2px); box-shadow: 0 6px 24px rgba(240,192,96,0.25); }

/* Touch drag ghost */
#drag-ghost {
  position: fixed; pointer-events: none; z-index: 9999;
  font-family: 'DM Mono', monospace; font-size: .85rem;
  padding: .4rem .9rem;
  background: var(--gold); color: var(--bg);
  display: none; transform: translate(-50%,-50%);
  white-space: nowrap;
}