/* Quotidia — D&D parchment theme */
:root {
  --gold: #B08D57;
  --gold-2: #d7c08a;
  --ink: #15110e;
  --ink-2: #2b231d;
  --parchment: #f2e6c9;
  --parchment-2: #e9d7b0;
  --leather: #3a261b;
  --steel: #6f7a86;
  --danger: #a83a3a;
  --ok: #2f7a43;

  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 18px;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background:
    radial-gradient(1200px 800px at 20% 0%, rgba(176,141,87,.18), transparent 60%),
    radial-gradient(900px 700px at 80% 10%, rgba(31,61,42,.18), transparent 55%),
    linear-gradient(180deg, #120f0d 0%, #171311 45%, #0f0d0b 100%);
  overflow-x: hidden;
}

.app-shell {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 14px 14px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background:
    linear-gradient(180deg, rgba(20,16,13,.92), rgba(20,16,13,.72));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(176,141,87,.22);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sigil {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 30% 30%, rgba(215,192,138,.9), rgba(176,141,87,.2) 55%, rgba(0,0,0,.2) 70%),
    linear-gradient(135deg, rgba(176,141,87,.25), rgba(255,255,255,.04));
  border: 1px solid rgba(176,141,87,.35);
  box-shadow: 0 0 0 2px rgba(0,0,0,.25) inset, 0 10px 25px rgba(0,0,0,.35);
  position: relative;
  overflow: hidden;
}
.sigil::after {
  content: "✶";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: rgba(255,255,255,.85);
  text-shadow: 0 2px 10px rgba(176,141,87,.35);
  transform: rotate(-8deg);
}

.brand-title {
  color: rgba(255,255,255,.92);
  font-weight: 800;
  letter-spacing: .4px;
}
.brand-subtitle {
  color: rgba(215,192,138,.86);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view {
  padding: 14px 14px calc(86px + var(--safe-bottom));
}

.card {
  background:
    radial-gradient(1200px 300px at 20% 0%, rgba(255,255,255,.30), transparent 55%),
    linear-gradient(180deg, rgba(242,230,201,.98), rgba(233,215,176,.96));
  border: 1px solid rgba(0,0,0,.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  pointer-events: none;
}
.card-inner {
  position: relative;
  padding: 16px;
}

.h1 {
  margin: 0 0 8px;
  font-size: 20px;
  letter-spacing: .2px;
}
.muted { color: rgba(21,17,14,.70); }

.grid {
  display: grid;
  gap: 12px;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(58,38,27,.10), rgba(58,38,27,.05));
  border: 1px solid rgba(0,0,0,.10);
}
.stat-pill b {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(176,141,87,.14);
  border: 1px solid rgba(176,141,87,.35);
  color: rgba(21,17,14,.85);
  font-weight: 700;
  font-size: 12px;
}

.progress {
  height: 12px;
  border-radius: 999px;
  background: rgba(0,0,0,.10);
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.12);
}
.progress > div {
  height: 100%;
  width: 0%;
  background:
    linear-gradient(90deg, rgba(176,141,87,.95), rgba(215,192,138,.95));
  box-shadow: 0 0 18px rgba(176,141,87,.45);
  transition: width .7s cubic-bezier(.2,.9,.2,1);
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 800;
  letter-spacing: .25px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: rgba(0,0,0,.85);
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  box-shadow: 0 10px 20px rgba(0,0,0,.25);
  transform: translateZ(0);
  transition: transform .08s ease, filter .2s ease, box-shadow .2s ease;
}
.btn:hover { filter: brightness(1.03); }
.btn:active {
  transform: translateY(1px) scale(.99);
  box-shadow: 0 6px 14px rgba(0,0,0,.22);
}
.btn-ghost {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.86);
  border: 1px solid rgba(176,141,87,.25);
  box-shadow: none;
}
.btn-ghost:hover { background: rgba(255,255,255,.08); }

.input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.20);
  background: rgba(255,255,255,.55);
  outline: none;
  box-shadow: 0 0 0 0 rgba(176,141,87,.0);
  transition: box-shadow .18s ease, border-color .18s ease;
}
.input:focus {
  border-color: rgba(176,141,87,.70);
  box-shadow: 0 0 0 4px rgba(176,141,87,.25);
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.row > * { flex: 1; }

.hr {
  height: 1px;
  background: rgba(0,0,0,.12);
  margin: 12px 0;
}

.list {
  display: grid;
  gap: 10px;
}
.quest {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.35);
}
.quest-head {
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 10px;
}
.quest-title {
  font-weight: 900;
  letter-spacing: .2px;
}
.quest-meta {
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
}
.small {
  font-size: 12px;
  color: rgba(21,17,14,.75);
}

.tabs {
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tab {
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.14);
  background: rgba(255,255,255,.22);
  cursor: pointer;
  font-weight: 800;
  font-size: 12px;
}
.tab.active {
  border-color: rgba(176,141,87,.55);
  background: rgba(176,141,87,.22);
  box-shadow: 0 0 0 3px rgba(176,141,87,.16);
}

.bottom-nav {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(10px + var(--safe-bottom));
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(20,16,13,.92), rgba(20,16,13,.75));
  border: 1px solid rgba(176,141,87,.25);
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 45px rgba(0,0,0,.45);
}
.nav-item {
  text-decoration: none;
  color: rgba(255,255,255,.80);
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  transition: background .2s ease, transform .08s ease;
}
.nav-item:hover { background: rgba(255,255,255,.06); }
.nav-item:active { transform: translateY(1px); }
.nav-item.active {
  color: rgba(255,255,255,.95);
  background: rgba(176,141,87,.14);
  box-shadow: 0 0 0 1px rgba(176,141,87,.35) inset;
}
.nav-ico {
  width: 22px;
  height: 22px;
  display: inline-block;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.35));
}
.nav-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .2px;
}

.toast-host {
  position: fixed;
  top: 70px;
  right: 12px;
  z-index: 60;
  display: grid;
  gap: 10px;
  max-width: min(420px, calc(100vw - 24px));
}
.toast {
  padding: 12px 14px;
  border-radius: 16px;
  color: rgba(255,255,255,.90);
  background: rgba(20,16,13,.92);
  border: 1px solid rgba(176,141,87,.25);
  box-shadow: 0 14px 35px rgba(0,0,0,.45);
  animation: toastIn .35s cubic-bezier(.2,.9,.2,1);
}
.toast.ok { border-color: rgba(47,122,67,.45); }
.toast.err { border-color: rgba(168,58,58,.55); }
@keyframes toastIn {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.fx-host {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 55;
}
.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(215,192,138,.95), rgba(176,141,87,.95));
  box-shadow: 0 0 18px rgba(176,141,87,.55);
  animation: pop 900ms cubic-bezier(.2,.9,.2,1) forwards;
}
@keyframes pop {
  0% { transform: translate(0,0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(260deg) scale(.2); opacity: 0; }
}

.hidden { display:none !important; }

/* Screen transition (parchment slide) */
.page {
  animation: pageIn .35s cubic-bezier(.2,.9,.2,1);
}
@keyframes pageIn {
  from { transform: translateY(10px); opacity: 0; filter: blur(2px); }
  to { transform: translateY(0); opacity: 1; filter: blur(0); }
}

@media (min-width: 820px) {
  .view {
    max-width: 920px;
    margin: 0 auto;
  }
  .bottom-nav {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 520px;
  }
}
