:root {
  --cream: #f5f1e8;
  --paper: #fbf8f1;
  --forest: #2f3e34;
  --moss: #5e7a5a;
  --sage: #a9b8a0;
  --gold: #d9a441;
  --clay: #b8795a;
  --ink: #2b2b28;
  --muted: #7a7a70;
  --line: #e2dccb;
  --radius: 18px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, "Segoe UI", system-ui, Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--sans); }
body { min-height: 100vh; }
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--cream); position: relative; padding-bottom: 88px; }
@media (min-width: 520px) { body { background: #e8e2d2; } #app { box-shadow: 0 0 40px rgba(0,0,0,.08); } }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -.01em; }
p { margin: 0; line-height: 1.5; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
.view { padding: 22px 20px 12px; animation: in .25s ease; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
.hide { display: none !important; }

/* topbar */
.topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.back { width: 38px; height: 38px; border-radius: 50%; background: var(--paper); border: 1px solid var(--line); font-size: 18px; }
.topbar h2 { font-size: 20px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 20px; border-radius: 999px; font-weight: 600; font-size: 15px; transition: transform .1s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--forest); color: var(--cream); }
.btn.gold { background: var(--gold); color: var(--forest); }
.btn.ghost { background: var(--paper); border: 1px solid var(--line); }
.btn.link { padding: 8px 4px; color: var(--moss); }
.btn.danger { color: #a4452c; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* cards */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.hero { background: var(--forest); color: var(--cream); border: 0; padding: 20px; }
.card.hero .eyebrow { color: var(--sage); }
.card.hero h2 { font-size: 23px; margin: 8px 0; }
.card.hero p { color: #d8dfd1; }
.card.tap { width: 100%; text-align: left; display: block; }
.badge { font-size: 10px; letter-spacing: .1em; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: #e7eadd; color: var(--moss); white-space: nowrap; }
.badge.hip { background: #f4e8cf; color: #8a6420; }
.badge.draft { background: #efe0d6; color: var(--clay); }

/* welcome */
.welcome { text-align: center; padding-top: 56px; }
.welcome .logo { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 24px; display: block; }
.welcome h1 { font-size: 44px; }
.welcome .tag { font-family: var(--serif); font-style: italic; color: var(--moss); margin: 6px 0 28px; }
.welcome .lead { color: var(--muted); max-width: 320px; margin: 0 auto 26px; }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.role { padding: 18px 10px; border-radius: var(--radius); background: var(--paper); border: 2px solid var(--line); font-weight: 600; }
.role.on { border-color: var(--forest); background: #ecefe4; }
.role span { display: block; font-size: 26px; margin-bottom: 4px; }
.field { text-align: left; display: block; }
.field > span { display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], textarea, select { width: 100%; font: inherit; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--moss); outline-offset: 1px; }

/* home */
.greet { margin-bottom: 20px; }
.greet h1 { font-size: 30px; margin-top: 4px; line-height: 1.1; }
.sec { display: flex; justify-content: space-between; align-items: baseline; margin: 26px 0 10px; }
.sec h3 { font-size: 19px; }
.item { display: block; width: 100%; text-align: left; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 10px; }
.item .t { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.item .s { color: var(--muted); font-size: 13px; margin-top: 3px; }
.item .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.empty { text-align: center; color: var(--muted); padding: 22px 10px; border: 1px dashed var(--line); border-radius: 16px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 9px 14px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 14px; }
.chip.on { background: var(--forest); color: var(--cream); border-color: var(--forest); }
.chip.static { background: #ecefe4; border-color: transparent; color: var(--forest); font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.chip.locked { opacity: .5; }

/* doc editor */
.progress { display: flex; gap: 6px; margin-bottom: 18px; }
.progress i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.progress i.on { background: var(--moss); }
.q h2 { font-size: 26px; margin: 6px 0 8px; line-height: 1.2; }
.q p { color: var(--muted); margin-bottom: 14px; }
.quote { border-left: 3px solid var(--gold); padding: 6px 12px; margin: 8px 0; background: #f7efd9; border-radius: 0 12px 12px 0; }
.quote q { font-family: var(--serif); font-style: italic; }
.quote .x { float: right; color: var(--muted); }
.toolbar { display: flex; gap: 8px; margin: 14px 0; }
.toolbar .btn { flex: 1; padding: 11px 8px; font-size: 14px; }
.rec { background: #a4452c !important; color: #fff !important; }
.media { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.media .m { position: relative; border-radius: 12px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); aspect-ratio: 1; }
.media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media .m.audio { grid-column: span 3; aspect-ratio: auto; padding: 8px; }
.media audio { width: 100%; }
.media .x { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.55); color: #fff; width: 24px; height: 24px; border-radius: 50%; font-size: 13px; }
.actions { display: flex; gap: 10px; margin-top: 20px; }
.actions .btn { flex: 1; }

/* project detail */
.kv { margin-top: 18px; }
.kv .eyebrow { margin-bottom: 6px; display: block; }
.kv .big { font-family: var(--serif); font-size: 21px; line-height: 1.25; }

/* nav */
nav.tabs { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background: var(--paper); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); z-index: 5; }
nav.tabs button { padding: 6px 0; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; font-weight: 600; }
nav.tabs button span { font-size: 21px; line-height: 1; }
nav.tabs button.on { color: var(--forest); }

/* provocation card */
.prov { background: linear-gradient(160deg, #e9eadb, #f7efd9); border: 1px solid var(--line); border-radius: 22px; padding: 18px; margin-top: 14px; }
.prov h3 { font-size: 22px; margin: 6px 0 8px; }
.prov blockquote { margin: 12px 0; padding-left: 12px; border-left: 3px solid var(--moss); font-family: var(--serif); font-style: italic; }

/* mode provocación */
.mode { position: fixed; inset: 0; background: #1d2620; color: #e9eadb; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.mode .eyebrow { color: var(--gold); }
.mode h1 { font-size: 34px; margin: 14px 0 6px; font-weight: 500; }
.mode .time { font-family: var(--serif); font-size: 64px; margin: 20px 0; font-variant-numeric: tabular-nums; }
.mode .note { color: #9fae98; max-width: 300px; margin-bottom: 26px; }
.mode .round { display: flex; gap: 18px; margin-bottom: 30px; }
.mode .round button { width: 82px; height: 82px; border-radius: 50%; background: #2f3e34; font-size: 13px; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.mode .round button span { font-size: 26px; }
.mode .round button.rec { background: #a4452c !important; }
.mode .count { color: #9fae98; font-size: 13px; margin-bottom: 18px; }

/* profile */
.avatar { width: 76px; height: 76px; border-radius: 50%; background: var(--moss); color: var(--cream); display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 32px; margin: 8px auto 12px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; text-align: center; }
.stats .card { padding: 12px 6px; }
.stats b { font-family: var(--serif); font-size: 26px; display: block; }
.step { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.step .dot { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--line); display: flex; align-items: center; justify-content: center; font-size: 15px; }
.step.done .dot { background: var(--gold); }
.step b { display: block; }
.step.next { opacity: .75; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 100px; transform: translate(-50%, 20px); background: var(--forest); color: var(--cream); padding: 11px 18px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* impresión: panel de documentación */
@media print {
  body { background: #fff; }
  #app { box-shadow: none; max-width: none; padding: 0; }
  nav.tabs, .no-print, .topbar { display: none !important; }
  .view { padding: 0; animation: none; }
  .media { grid-template-columns: repeat(4, 1fr); }
}
