:root {
  --bg: #0c1230;
  --panel: rgba(22, 32, 72, .88);
  --line: rgba(232, 197, 107, .4);
  --text: #f6f1e4;
  --muted: #b7c0dc;
  --gold: #e8c56b;
  --indigo: #24306a;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: Palatino, "Iowan Old Style", "Palatino Linotype", serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
body {
  background:
    radial-gradient(80% 40% at 50% -10%, #2a3a86 0%, transparent 55%),
    radial-gradient(50% 40% at 100% 100%, #1a2048 0%, transparent 50%),
    var(--bg);
}
#loom { height: 100%; max-width: 480px; margin: 0 auto; position: relative; }
.screen {
  position: absolute; inset: 0 0 calc(66px + var(--safe-b)) 0;
  padding: calc(12px + var(--safe-t)) 14px 14px;
  display: flex; flex-direction: column; gap: 10px; overflow: auto;
}
.hidden { display: none !important; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bar h2, .brand { margin: 0; font-size: 1.15rem; }
.brand { color: var(--gold); font-weight: 700; letter-spacing: .12em; }
.pill, .tag, .hint { color: var(--muted); font-size: .86rem; margin: 0; }
.pill {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
}
.mini { width: 28px; height: 28px; object-fit: contain; }
.canvas-wrap {
  flex: 1; min-height: 240px; border-radius: 22px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(36,48,106,.55), rgba(8,12,32,.8));
  overflow: hidden;
}
#net { width: 100%; height: 100%; display: block; }
.detail {
  padding: 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line);
}
.detail strong { display: block; color: var(--gold); }
.detail p { margin: 6px 0 0; color: var(--muted); font-size: .9rem; }
.types { display: flex; gap: 6px; flex-wrap: wrap; }
.types button {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 12px; padding: 7px 10px; font: inherit; font-size: .78rem; cursor: pointer;
}
.types button.on { background: var(--gold); color: #1a1408; border-color: var(--gold); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; color: var(--muted); }
.field input, .field textarea, .field select {
  border: 1px solid var(--line); background: #10183a; color: var(--text);
  border-radius: 14px; padding: 12px; font: inherit; font-size: 1rem;
}
.btn {
  border: 0; border-radius: 16px; padding: 13px 16px; font: inherit; font-weight: 700; cursor: pointer;
}
.btn.gold { background: linear-gradient(135deg, #f3dd9a, var(--gold) 45%, #b8893a); color: #1a1408; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { color: #ffb4c0; border-color: rgba(255,180,192,.45); }
.list, .days { display: flex; flex-direction: column; gap: 8px; }
.card {
  padding: 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line);
}
.card strong { display: block; }
.card span, .card p { color: var(--muted); font-size: .82rem; margin: 4px 0 0; }
.card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card button {
  border: 1px solid var(--line); background: transparent; color: var(--gold);
  border-radius: 10px; padding: 6px 8px; font: inherit; cursor: pointer;
}
.tog {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 14px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--panel);
}
.dock {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(480px, 100%); display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 4px calc(8px + var(--safe-b)); background: rgba(8, 12, 32, .96);
  border-top: 1px solid var(--line); z-index: 8;
}
.dock button {
  background: none; border: 0; color: var(--muted); font: inherit; font-size: .58rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.dock button img { width: 20px; height: 20px; object-fit: contain; }
.dock button.on { color: var(--gold); }
.dot { font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; color: var(--gold); }
