/* ===== VEIL — estilos (mobile-first) ===== */
:root {
  --void: #09090b;
  --panel: #121216;
  --panel-2: #1a1a20;
  --line: #2a2a33;
  --bone: #ece8e4;
  --dim: #8d8a94;
  --wine: #7a1f3d;
  --wine-hi: #a8325a;
  --violet: #7b5cd6;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--void); color: var(--bone); font-family: var(--sans); font-size: 15px; line-height: 1.5; }
body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(123, 92, 214, .16), transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(122, 31, 61, .18), transparent 50%),
    var(--void);
  background-attachment: fixed;
}
#app { max-width: 720px; margin: 0 auto; padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); overflow-x: hidden; }
.view { display: none; }
.view.active { display: block; animation: fade .45s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h2 { font-size: 12px; letter-spacing: .22em; color: var(--dim); font-weight: 600; margin: 28px 0 12px; }
p.muted, .muted { color: var(--dim); }
.note { color: var(--dim); font-style: italic; font-family: var(--serif); margin-top: 14px; }

/* Hero */
.logo { font-family: var(--serif); font-weight: 400; font-size: clamp(54px, 18vw, 92px); letter-spacing: .28em; margin-right: -.28em; line-height: 1; text-align: center; animation: glow 5s ease-in-out infinite; }
@keyframes glow { 0%, 100% { text-shadow: 0 0 18px rgba(123, 92, 214, .25); } 50% { text-shadow: 0 0 34px rgba(168, 50, 90, .5); } }
.tag { text-align: center; color: var(--dim); letter-spacing: .3em; font-size: 12px; margin: 10px 0 26px; }
.hud { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.hud-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.lvl { font-family: var(--serif); font-size: 26px; letter-spacing: .12em; }
.streak { font-size: 13px; letter-spacing: .14em; color: var(--bone); }
.xp-text { font-size: 12px; color: var(--dim); margin-top: 8px; letter-spacing: .08em; }

/* Barras */
.bar { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--wine), var(--violet)); border-radius: 99px; transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.bar.thin { height: 5px; }

/* Atributos */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; min-width: 0; }
.card .nm { font-size: 12px; letter-spacing: .14em; margin-bottom: 4px; }
.card .lv { font-family: var(--serif); font-size: 22px; margin-bottom: 8px; }
.card .xp { font-size: 12px; color: var(--dim); margin-top: 6px; }

/* Quests */
.quest { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--wine); border-radius: 12px; padding: 16px; margin-bottom: 12px; transition: opacity .4s, border-color .4s; }
.quest.done { opacity: .55; border-left-color: var(--violet); }
.qh { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; letter-spacing: .16em; color: var(--dim); margin-bottom: 8px; flex-wrap: wrap; }
.qh .rw { color: var(--wine-hi); }
.quest p { margin-bottom: 14px; }

.btn { width: 100%; background: transparent; color: var(--bone); border: 1px solid var(--wine-hi); border-radius: 10px; padding: 12px; font: 600 12px var(--sans); letter-spacing: .2em; cursor: pointer; transition: background .25s, transform .1s; }
.btn:hover { background: var(--wine); }
.btn:active { transform: scale(.98); }
.btn:disabled { border-color: var(--line); color: var(--dim); cursor: default; background: transparent; }
.btn.inline { width: auto; padding: 10px 18px; }

/* Expression Lab */
.lab-intro { font-family: var(--serif); font-size: 18px; line-height: 1.6; margin-bottom: 4px; }
.opt { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.opt .on { font-weight: 600; margin-bottom: 8px; }
.rate { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.rate button { background: var(--panel-2); color: var(--dim); border: 1px solid var(--line); border-radius: 8px; padding: 8px 4px; font: 12px var(--sans); cursor: pointer; transition: all .2s; }
.rate button.sel { color: var(--bone); border-color: var(--violet); background: rgba(123, 92, 214, .22); }
.rate button.sel.no { border-color: var(--line); background: var(--void); color: var(--dim); text-decoration: line-through; }

/* Formulários */
textarea, input[type=text] { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: var(--bone); font: 15px var(--sans); padding: 12px; margin-bottom: 10px; resize: vertical; }
textarea { min-height: 96px; }
textarea:focus, input:focus, button:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.refl { border-left: 2px solid var(--line); padding: 4px 0 4px 12px; margin-bottom: 12px; }
.refl small { color: var(--dim); display: block; letter-spacing: .1em; font-size: 11px; }

/* Conquistas e perfil */
.ach { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.ach .ic { font-size: 26px; filter: grayscale(1) opacity(.35); }
.ach.on { border-color: var(--wine-hi); }
.ach.on .ic { filter: none; }
.ach b { display: block; font-size: 13px; letter-spacing: .12em; }
.ach span { color: var(--dim); font-size: 13px; }
.row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.row span:first-child { color: var(--dim); }
.danger { margin-top: 28px; background: none; border: none; color: var(--dim); font: 12px var(--sans); text-decoration: underline; cursor: pointer; }

/* Navegação inferior */
#nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; background: rgba(12, 12, 15, .92); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); z-index: 10; }
#nav button { flex: 1; max-width: 120px; background: none; border: none; color: var(--dim); font: 10px var(--sans); letter-spacing: .08em; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; transition: color .2s; }
#nav button span { font-size: 20px; filter: grayscale(1); transition: filter .2s; }
#nav button.active { color: var(--bone); }
#nav button.active span { filter: none; }

/* Recompensa e toast */
#reward { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(5, 5, 8, .82); backdrop-filter: blur(6px); text-align: center; padding: 20px; animation: fade .3s ease; }
#reward[hidden], #toast[hidden] { display: none; }
.rw-box { animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
.rw-box .big { font-family: var(--serif); font-size: 30px; letter-spacing: .18em; margin-bottom: 10px; }
.rw-box .gain { color: var(--wine-hi); letter-spacing: .14em; font-size: 14px; }
.rw-box .lvlup { margin-top: 24px; font-family: var(--serif); font-size: 40px; letter-spacing: .2em; color: var(--bone); text-shadow: 0 0 30px var(--violet); animation: glow 2s infinite; }
.rw-box .sub { color: var(--dim); margin-top: 4px; font-style: italic; font-family: var(--serif); }
.ring { width: 90px; height: 90px; margin: 0 auto 20px; border-radius: 50%; border: 2px solid var(--violet); animation: ring 1.2s ease-out infinite; }
@keyframes pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
@keyframes ring { from { box-shadow: 0 0 0 0 rgba(123, 92, 214, .6); } to { box-shadow: 0 0 0 40px rgba(123, 92, 214, 0); } }
#toast { position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 40; background: var(--panel-2); border: 1px solid var(--wine-hi); border-radius: 99px; padding: 10px 20px; font-size: 13px; letter-spacing: .08em; max-width: 92vw; animation: pop .4s ease; }

/* Tablet / desktop */
@media (min-width: 640px) {
  #app { padding-top: 40px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1000px) {
  #app { max-width: 820px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
