/* Base: colores, pergamino, botones, portada y lobby */
:root {
  --ink: #2a1c0e;
  --parch: #f4e7c8;
  --parch2: #e9d6a8;
  --wood: #5a3a1e;
  --gold: #e3ad3f;
  --gold2: #ffd56b;
  --sea: #0e2f47;
  --sea2: #164a6e;
  --red: #c8372d;
  --r-wood: #2f7a3c; --r-brick: #c4512d; --r-sheep: #86c34a; --r-wheat: #e5b33a; --r-ore: #7c8798;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 50% 45%, #1f6a98 0%, #134669 45%, #0b2438 100%);
  overflow: hidden;
}
body::before { /* olas sutiles */
  content: ''; position: fixed; inset: 0; pointer-events: none; opacity: .12; z-index: -1;
  background-image: repeating-radial-gradient(circle at 30% 40%, transparent 0 18px, rgba(255,255,255,.5) 19px 20px, transparent 21px 40px);
  animation: drift 40s linear infinite;
}
@keyframes drift { to { background-position: 400px 200px; } }
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; }
button { font-family: inherit; }

/* ───────── pergamino y botones ───────── */
.parchment {
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.55), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(160,110,40,.18), transparent 50%),
    linear-gradient(160deg, var(--parch), var(--parch2));
  border: 3px solid #8a5d2b;
  box-shadow: inset 0 0 0 2px rgba(255,240,200,.6), inset 0 0 40px rgba(120,80,30,.25), var(--shadow);
  border-radius: 16px;
}
.btn {
  border: 2px solid #5a3a1e; background: linear-gradient(#fff6dc, #e8cf97); color: var(--ink);
  font-weight: 800; padding: 9px 16px; border-radius: 10px; cursor: pointer; font-size: 15px;
  box-shadow: 0 3px 0 #5a3a1e; transition: transform .08s, filter .15s, box-shadow .08s;
}
.btn:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #5a3a1e; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.4); }
.btn.gold { background: linear-gradient(#ffe08a, #e3a531); }
.btn.red { background: linear-gradient(#f08a7a, #c8372d); color: #fff; }
.btn.ghost { background: rgba(255,255,255,.25); box-shadow: none; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.big { padding: 13px 22px; font-size: 18px; width: 100%; }
.btn.huge { padding: 16px 34px; font-size: 22px; font-family: 'Cinzel', serif; }
.btn.round { width: 34px; height: 34px; padding: 0; border-radius: 50%; font-size: 20px; line-height: 1; }
.btn.round.small { width: 26px; height: 26px; font-size: 16px; }
.btn.glowing { animation: btnGlow 1.4s ease-in-out infinite; }
@keyframes btnGlow { 50% { box-shadow: 0 3px 0 #5a3a1e, 0 0 26px 6px rgba(255,213,107,.85); } }
input {
  font-family: inherit; font-size: 17px; font-weight: 700; padding: 11px 14px; border-radius: 10px;
  border: 2px solid #8a5d2b; background: #fffaf0; color: var(--ink); outline: none; width: 100%;
}
input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227,173,63,.35); }
.hint { font-size: 13px; opacity: .75; margin: 8px 0; }
.dots i { animation: dot 1.4s infinite; font-style: normal; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 0%, 60%, 100% { opacity: .2; } 30% { opacity: 1; } }

/* ───────── portada ───────── */
#home { display: grid; place-items: center; }
.home-card { width: min(430px, 92vw); padding: 34px 30px 24px; text-align: center; position: relative; display: grid; gap: 12px; animation: rise .6s ease-out; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
.home-hex {
  width: 90px; height: 104px; margin: -86px auto 0; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: conic-gradient(var(--r-wood) 0 60deg, var(--r-wheat) 0 120deg, var(--r-sheep) 0 180deg, var(--r-brick) 0 240deg, var(--r-ore) 0 300deg, #e2c07c 0);
  animation: spin 18s linear infinite; filter: drop-shadow(0 6px 8px rgba(0,0,0,.4));
}
@keyframes spin { to { transform: rotate(360deg); } }
.title { font-family: 'Cinzel', serif; font-weight: 900; font-size: 56px; margin: 4px 0 0; letter-spacing: 3px; color: #6b3f12; text-shadow: 0 2px 0 #fff3cf, 0 4px 10px rgba(0,0,0,.2); }
.title-sm { font-family: 'Cinzel', serif; font-weight: 900; font-size: 30px; margin: 0; color: #6b3f12; }
.sub { margin: -6px 0 6px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; font-size: 12px; opacity: .7; }
.or { display: flex; align-items: center; gap: 10px; font-size: 13px; opacity: .7; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: #8a5d2b; }
.join-row { display: flex; gap: 8px; }
#code { text-transform: uppercase; letter-spacing: 6px; text-align: center; font-family: 'Cinzel', serif; }

/* ───────── lobby ───────── */
#lobby { display: flex; overflow: auto; padding: 20px; }
.lobby-card { width: min(980px, 96vw); padding: 24px 28px; margin: auto; }
.lobby-card.enter { animation: rise .5s ease-out; }
.lobby-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.room-code { font-weight: 800; display: flex; align-items: center; gap: 10px; }
.room-code b { font-family: 'Cinzel', serif; font-size: 30px; letter-spacing: 6px; background: #2a1c0e; color: var(--gold2); padding: 2px 14px; border-radius: 8px; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.slot { border-radius: 12px; padding: 12px; min-height: 74px; display: flex; align-items: center; gap: 10px; }
.slot.filled { background: rgba(255,255,255,.55); border: 2px solid var(--c); box-shadow: inset 6px 0 0 var(--c); }
.slot.filled.new { animation: pop .4s ease-out; }
.slot.empty { border: 2px dashed rgba(138,93,43,.5); justify-content: center; opacity: .6; font-size: 13px; font-weight: 700; }
.slot-house { width: 34px; flex: none; }
.slot-name { font-weight: 800; flex: 1; }
.slot-name em { font-weight: 600; opacity: .6; font-size: 12px; }
.slot-wins { font-weight: 800; font-size: 13px; }
@keyframes pop { 0% { transform: scale(.7); opacity: 0; } 70% { transform: scale(1.05); } }
.lobby-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.lobby-box { background: rgba(255,255,255,.35); border-radius: 12px; padding: 12px 14px; }
.lobby-box h3 { margin: 0 0 10px; font-family: 'Cinzel', serif; font-size: 16px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #2a1c0e; background: var(--c); cursor: pointer; transition: transform .15s; }
.swatch:hover:not(:disabled) { transform: scale(1.12); }
.swatch.sel { box-shadow: 0 0 0 4px var(--gold); transform: scale(1.12); }
.swatch:disabled { opacity: .25; cursor: not-allowed; }
.vp-picker { display: flex; align-items: center; justify-content: center; gap: 16px; }
.vp-num { font-family: 'Cinzel', serif; font-size: 46px; font-weight: 900; min-width: 90px; text-align: center; }
.vp-num span { font-size: 24px; }
input[type=range] { padding: 0; border: none; background: none; accent-color: #b5772a; box-shadow: none; }
.vp-presets { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }
.chip { border: 2px solid #8a5d2b; background: #fff6dc; border-radius: 20px; padding: 2px 10px; font-weight: 800; cursor: pointer; }
.chip.sel { background: var(--gold); }
.waiting { text-align: center; font-weight: 800; padding: 12px; background: rgba(255,255,255,.35); border-radius: 10px; }

/* selector de mapa */
.mapbox { margin: 12px 0 4px; }
.maps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mapcard {
  position: relative; display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border-radius: 12px; cursor: pointer;
  border: 2px solid #8a5d2b; background: rgba(255,255,255,.45); color: var(--ink); transition: transform .15s, box-shadow .15s;
}
.mapcard:hover:not(:disabled) { transform: translateY(-2px); }
.mapcard:disabled { cursor: default; }
.mapcard:disabled:not(.sel) { opacity: .55; }
.mapcard.sel { background: linear-gradient(#fff3c8, #f0cf7a); box-shadow: 0 0 0 3px var(--gold), 0 6px 16px rgba(0,0,0,.2); }
.mapcard div { display: flex; flex-direction: column; }
.mapcard b { font-family: 'Cinzel', serif; font-size: 18px; }
.mapcard span { font-weight: 800; font-size: 13px; }
.mapcard small { font-size: 12px; opacity: .75; }
.mapprev { width: 74px; height: 64px; flex: none; }
.mapcard .check { position: absolute; top: 6px; right: 10px; font-style: normal; font-weight: 900; color: #3d8a2e; }
.slots.four { grid-template-columns: repeat(2, 1fr); }
