/* valentinominotti.com — dark, layered, mobile-first */
:root {
  --bg: #0b0d12;
  --bg-2: #10131a;
  --surface: #151923;
  --surface-2: #1b202c;
  --surface-3: #222836;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #eef0f4;
  --text-2: #a7adba;
  --text-3: #6b7280;
  --accent: #c9a96e;
  --accent-2: #e2c48c;
  --accent-ink: #1a1408;
  --danger: #e5646b;
  --ok: #6fcf97;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 2px 4px rgba(0, 0, 0, 0.5), 0 18px 48px rgba(0, 0, 0, 0.5);
  --r: 18px;
  --r-s: 12px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 50% -200px, rgba(201, 169, 110, 0.08), transparent 60%),
    radial-gradient(800px 500px at 100% 100%, rgba(255, 255, 255, 0.025), transparent 60%);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-2); text-decoration: none; }

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--sat) + 16px) 18px calc(var(--sab) + 20px);
}

/* ---------- header */
.top {
  display: flex; align-items: center; gap: 14px;
  padding: 6px 2px 20px;
}
.avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--surface-2) url("icon-192.png") center/cover;
  box-shadow: 0 0 0 1px var(--line-2), var(--shadow-1);
  flex: none;
}
.top .who { flex: 1; min-width: 0; }
.top .who b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.top .who span { display: block; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow-1);
  display: grid; place-items: center; color: var(--text-2);
}
.icon-btn:active { transform: translateY(1px); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- cards */
.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-2);
  padding: 22px 20px;
  position: relative;
}
.card::before {           /* soft top highlight = depth */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
  border-radius: var(--r) var(--r) 0 0;
}
h1 { margin: 0 0 6px; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
h2 { margin: 0 0 4px; font-size: 20px; font-weight: 650; letter-spacing: -0.015em; }
.sub { margin: 0 0 18px; color: var(--text-2); font-size: 15px; }

/* ---------- fields */
label { display: block; font-size: 13px; color: var(--text-2); margin: 0 0 6px 2px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=password] {
  width: 100%; height: 52px; padding: 0 16px;
  background: var(--bg-2);
  border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
  outline: none; font-size: 17px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: rgba(201, 169, 110, 0.6); box-shadow: inset 0 2px 6px rgba(0,0,0,.4), 0 0 0 3px rgba(201, 169, 110, 0.15); }
input::placeholder { color: var(--text-3); }

/* ---------- buttons */
.btn {
  width: 100%; height: 54px; border-radius: 15px; border: 0;
  font-size: 17px; font-weight: 600; letter-spacing: 0.01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .08s, filter .15s, opacity .15s;
}
.btn:active { transform: translateY(1px) scale(0.995); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn-primary {
  color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 8px 22px rgba(201, 169, 110, 0.22), 0 2px 4px rgba(0,0,0,.4);
}
.btn-ghost {
  color: var(--text); background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--line-2); box-shadow: var(--shadow-1);
}
.btn-text { background: none; border: 0; color: var(--text-2); height: 44px; }
.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }

/* ---------- messages */
.msg { margin: 12px 0 0; padding: 12px 14px; border-radius: var(--r-s); font-size: 14px; line-height: 1.4; }
.msg-err { background: rgba(229, 100, 107, 0.12); color: #ffb3b7; border: 1px solid rgba(229, 100, 107, 0.25); }
.msg-ok { background: rgba(111, 207, 151, 0.1); color: #a9e6c3; border: 1px solid rgba(111, 207, 151, 0.22); }
.msg-info { background: rgba(255,255,255,.04); color: var(--text-2); border: 1px solid var(--line); }

/* ---------- compose */
.compose { display: flex; flex-direction: column; flex: 1; }
.editor {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.45);
  transition: border-color .15s, box-shadow .15s;
}
.editor:focus-within { border-color: rgba(201, 169, 110, 0.5); box-shadow: inset 0 2px 8px rgba(0,0,0,.45), 0 0 0 3px rgba(201, 169, 110, 0.13); }
.editor.listening { border-color: rgba(201, 169, 110, 0.8); }
textarea {
  display: block; width: 100%; min-height: 220px; max-height: 50vh;
  padding: 16px 16px 12px; border: 0; background: transparent; outline: none; resize: none;
  font-size: 17px; line-height: 1.5;
}
textarea::placeholder { color: var(--text-3); }
.editor-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px 10px 16px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--text-3);
}
.editor-bar .count.over { color: var(--danger); }
.lang {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
  font-size: 12px; font-weight: 600;
}
.lang svg { width: 12px; height: 12px; opacity: .7; }
.lang-menu {
  position: absolute; right: 12px; bottom: 50px; z-index: 5;
  background: var(--surface-3); border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: var(--shadow-2); padding: 6px; min-width: 160px;
}
.lang-menu button {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font-size: 14px;
}
.lang-menu button.on { color: var(--accent-2); }
.lang-menu button:hover, .lang-menu button:active { background: rgba(255,255,255,.06); }

.actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.mic {
  width: 74px; height: 74px; border-radius: 50%; border: 0; flex: none;
  background: linear-gradient(180deg, var(--surface-3), var(--surface));
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255,255,255,.08);
  display: grid; place-items: center; color: var(--text); position: relative;
}
.mic svg { width: 28px; height: 28px; }
.mic.on { color: var(--accent-ink); background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-color: transparent; }
.mic.on::before, .mic.on::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(201, 169, 110, 0.55); animation: pulse 1.6s ease-out infinite;
}
.mic.on::after { animation-delay: .8s; }
@keyframes pulse { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.mic:disabled { opacity: .35; }
.actions .btn { flex: 1; height: 58px; }
.hint { margin: 14px 2px 0; font-size: 13px; color: var(--text-3); text-align: center; }
.hint.live { color: var(--accent-2); }

/* ---------- confirm sheet */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
  animation: fade .18s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px;
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--line-2); border-bottom: 0;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -20px 60px rgba(0,0,0,.6);
  padding: 14px 20px calc(var(--sab) + 20px);
  animation: up .22s cubic-bezier(.2,.8,.2,1);
  max-height: 88vh; display: flex; flex-direction: column;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); margin: 0 auto 16px; }
.preview {
  flex: 1; overflow: auto; white-space: pre-wrap; word-break: break-word;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; margin: 12px 0 16px; font-size: 16px; line-height: 1.5; max-height: 48vh;
  box-shadow: inset 0 2px 8px rgba(0,0,0,.4);
}
.meta { font-size: 13px; color: var(--text-3); margin-bottom: 4px; }

/* ---------- done */
.done { text-align: center; padding: 34px 20px; }
.check {
  width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 18px;
  background: radial-gradient(circle at 50% 35%, rgba(111,207,151,.35), rgba(111,207,151,.08) 70%);
  border: 1px solid rgba(111,207,151,.35); display: grid; place-items: center; color: var(--ok);
  box-shadow: 0 10px 30px rgba(111,207,151,.12);
  animation: pop .35s cubic-bezier(.2,.9,.3,1.4);
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.check svg { width: 38px; height: 38px; }

/* ---------- login */
.login { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.brand { text-align: center; margin-bottom: 26px; }
.brand .avatar { width: 92px; height: 92px; margin: 0 auto 14px; box-shadow: 0 0 0 1px var(--line-2), 0 0 0 6px rgba(201,169,110,.08), var(--shadow-2); }
.brand h1 { font-size: 22px; }
.brand p { margin: 0; color: var(--text-3); font-size: 14px; }
.foot { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 26px; }

/* ---------- install banner */
.install {
  margin-top: 18px; padding: 14px 16px; border-radius: var(--r-s);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  font-size: 13px; color: var(--text-2); display: flex; gap: 12px; align-items: center;
}
.install b { color: var(--text); }
.install .x { margin-left: auto; color: var(--text-3); background: none; border: 0; font-size: 18px; }

/* ---------- admin */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--text-3); font-weight: 500; font-size: 12px; }
.table .dim { color: var(--text-3); font-size: 12px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: rgba(255,255,255,.06); color: var(--text-2); }
.pill.off { background: rgba(229,100,107,.15); color: #ffb3b7; }
.pill.adm { background: rgba(201,169,110,.15); color: var(--accent-2); }
.mini { height: 32px; padding: 0 10px; border-radius: 8px; font-size: 13px; width: auto; margin: 2px 4px 2px 0; }
.wrap-x { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.admin .app { max-width: 900px; }
.secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; letter-spacing: .04em;
  background: var(--bg-2); border: 1px dashed rgba(201,169,110,.5); border-radius: 12px; padding: 12px 14px; margin: 10px 0;
  user-select: all; -webkit-user-select: all;
}
.stack > * + * { margin-top: 16px; }

@media (min-width: 600px) {
  .app { padding-top: 40px; }
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 24px; border-bottom: 1px solid var(--line-2); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* utilities (no inline styles: CSP) */
.done .sub { margin-bottom: 22px; }
.sheet .btn-text { width: 100%; }
.top .btn-text { width: auto; }
.row[data-wrap] { flex-wrap: wrap; }
.field[data-grow] { flex: 1; min-width: 180px; }
#f-new .btn-primary { max-width: 260px; }

/* ---------- inbox (questions from the owner) */
.inbox { margin-bottom: 14px; border-color: rgba(201,169,110,.35); }
.inbox-head { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); margin-bottom: 10px; }
.inbox-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.q { padding: 12px 0; border-top: 1px solid var(--line); }
.q:first-child { border-top: 0; padding-top: 0; }
.q p { margin: 0 0 8px; font-size: 16px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.q .when { font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.q .btn { height: 40px; width: auto; padding: 0 16px; font-size: 14px; border-radius: 11px; }
.replying { margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: rgba(201,169,110,.1); border: 1px solid rgba(201,169,110,.3); font-size: 13px; color: var(--accent-2); display: flex; align-items: center; gap: 10px; }
.replying span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.replying button { background: none; border: 0; color: var(--text-2); font-size: 18px; line-height: 1; }
/* admin questions */
.qa-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
select { height: 52px; padding: 0 14px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); font-size: 16px; outline: none; }
textarea.ask { min-height: 90px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 12px 14px; box-shadow: inset 0 2px 6px rgba(0,0,0,.4); }

/* boot: brand fades in, views appear only when the session is known */
body.booting .app { animation: none; }
body.booting::before { content: ""; position: fixed; inset: 0; background: var(--bg) url("icon-192.png") center 38%/72px no-repeat; z-index: 100; animation: breathe 1.2s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: .85; } 50% { opacity: 1; } }
.app > section { animation: rise .22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.pw-back { width: 100%; margin-top: 6px; }
