/* Author: Remedolt */
:root {
  --bg: #f6efe4;
  --panel: #fffaf2;
  --ink: #2f2620;
  --muted: #8a7a6b;
  --line: #e7dccb;
  --accent: #c8743f;
  --accent-ink: #fff8f0;
  --her: #ffffff;
  --me: #f3d9bf;
  --danger: #b3412f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1613;
    --panel: #241d19;
    --ink: #f1e6d8;
    --muted: #a39281;
    --line: #382d26;
    --accent: #e0935f;
    --accent-ink: #1b1613;
    --her: #2c241f;
    --me: #5a3a25;
    --danger: #e98572;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 16px;
}
.login form {
  width: 100%;
  max-width: 340px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 24px;
  text-align: center;
}
.login img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }
.login h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 30px; margin: 12px 0 2px; }
.login p { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.field {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  outline: none;
}
.field:focus { border-color: var(--accent); }
.btn {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.btn:disabled { opacity: .6; }
.err { color: var(--danger); font-size: 14px; min-height: 20px; margin-top: 10px; }

.icon { border: 0; background: transparent; padding: 8px 10px; border-radius: 10px; color: var(--muted); font-size: 14px; }
.icon:hover { background: var(--bg); color: var(--ink); }

.scene { height: 100dvh; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 12px 16px 16px; }
.bar { width: 100%; display: flex; justify-content: flex-end; gap: 10px; }
.round { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); color: var(--ink); padding: 0; }
.round:hover { border-color: var(--accent); color: var(--accent); }
.round svg, .composer button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.stage { position: relative; flex: 1; min-height: 0; width: 100%; max-width: 1000px; border-radius: 26px; overflow: hidden; background: #1b1613; box-shadow: 0 18px 50px rgba(60, 35, 15, .22); transition: box-shadow .6s; }
.stage.busy { box-shadow: 0 18px 50px rgba(60, 35, 15, .22), 0 0 0 3px var(--accent); }
.portrait, .clip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.portrait { animation: breathe 14s ease-in-out infinite alternate; transform-origin: 50% 30%; transition: opacity .45s ease; }
.portrait.swap { opacity: 0; }
.clip { opacity: 0; transition: opacity .9s ease; pointer-events: none; }
.clip.on { opacity: 1; }
@keyframes breathe { from { transform: scale(1); } to { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .portrait { animation: none; } .clip { display: none; } }
.stage::after { content: ""; position: absolute; inset: 40% 0 0; background: linear-gradient(to top, rgba(20, 14, 10, .78), rgba(20, 14, 10, 0)); pointer-events: none; }
.who { position: absolute; top: 16px; left: 18px; z-index: 2; color: #fff8f0; text-shadow: 0 1px 8px rgba(0, 0, 0, .55); }
.who .name { font-family: Georgia, "Times New Roman", serif; font-size: 26px; line-height: 1.1; }
.who .status { font-size: 13px; opacity: .9; }
.feed { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; max-height: 50%; overflow-y: auto; padding: 60px 18px 16px; display: flex; flex-direction: column; gap: 6px; -webkit-mask-image: linear-gradient(to bottom, transparent, #000 60px); mask-image: linear-gradient(to bottom, transparent, #000 60px); scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .35) transparent; }
.feed > * { flex: none; }
.day { align-self: center; font-size: 12px; color: #fff8f0; padding: 3px 10px; margin: 6px 0; background: rgba(20, 14, 10, .45); border-radius: 999px; }
.msg { max-width: min(78%, 520px); padding: 8px 12px 6px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 2px 10px rgba(0, 0, 0, .18); }
.msg time { display: block; text-align: right; font-size: 11px; opacity: .65; margin-top: 2px; }
.msg.her { align-self: flex-start; background: rgba(255, 250, 242, .94); color: #2f2620; border-bottom-left-radius: 4px; }
.msg.me { align-self: flex-end; background: rgba(200, 116, 63, .94); color: #fff8f0; border-bottom-right-radius: 4px; }
.more { align-self: center; color: #fff8f0; background: rgba(20, 14, 10, .45); }
.more:hover { background: rgba(20, 14, 10, .65); color: #fff8f0; }
.typing { align-self: flex-start; color: #fff8f0; font-size: 14px; font-style: italic; padding: 4px 8px; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }

.composer { width: 100%; max-width: 1120px; display: flex; gap: 10px; align-items: flex-end; padding: 8px 8px 8px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 30px; box-shadow: 0 8px 24px rgba(60, 35, 15, .08); }
.composer:focus-within { border-color: var(--accent); }
.composer textarea { flex: 1; resize: none; max-height: 140px; padding: 10px 0; border: 0; background: transparent; outline: none; }
.composer button { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; padding: 0; background: var(--accent); color: var(--accent-ink); }
.composer button:hover { filter: brightness(1.08); }
:fullscreen .scene { padding-top: 10px; }
:fullscreen .stage { max-width: none; }
:fullscreen .composer { max-width: none; }
@media (max-width: 600px) {
  .scene { padding: 8px 8px 10px; gap: 8px; }
  .stage { border-radius: 20px; }
  .feed { max-height: 46%; padding: 50px 12px 12px; }
}

.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row .btn { width: auto; flex: 1; padding: 10px; font-size: 14px; }
a.icon { text-decoration: none; }
.set { max-width: 1040px; margin: 0 auto; padding: 16px; display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.set header { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.set header img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.set header h1 { flex: 1; margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 26px; }
.tabs { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px; }
.tabs a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.tabs svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs a:hover { background: var(--panel); }
.tabs a.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.pane { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; min-width: 0; }
.pane h2 { margin: 0 0 4px; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 24px; }
.pane .lead { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.pane label { display: block; font-weight: 600; font-size: 14px; margin: 16px 0 6px; }
.pane label small { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; }
.pane textarea.field { min-height: 140px; resize: vertical; }
.pane .btn { width: auto; padding: 11px 22px; margin-top: 8px; }
.pane .field { max-width: 560px; }
.pane .field.short { max-width: 160px; }
.check { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-weight: 400; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.note { min-height: 22px; font-size: 14px; margin-top: 10px; color: var(--muted); }
.note.ok { color: #3f8f5a; }
.note.bad { color: var(--danger); }
.card { border: 1px solid var(--line); border-radius: 14px; padding: 4px 16px 16px; margin: 16px 0; max-width: 600px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; background: var(--bg); border: 1px solid var(--line); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 12px 0 20px; }
.stats div { background: var(--bg); border-radius: 12px; padding: 12px; }
.stats b { display: block; font-size: 22px; font-weight: 600; }
.stats span { font-size: 13px; color: var(--muted); }
.tablewrap { overflow-x: auto; }
table.log { width: 100%; border-collapse: collapse; font-size: 14px; }
table.log th, table.log td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.log th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
table.log td.wrap { overflow-wrap: anywhere; min-width: 140px; }
@media (max-width: 720px) {
  .set { grid-template-columns: 1fr; gap: 14px; }
  .tabs { flex-direction: row; overflow-x: auto; position: static; padding-bottom: 4px; }
  .tabs a { white-space: nowrap; }
  .pane { padding: 16px; }
}

table.log th[scope], .pane table.log tbody th { width: 170px; }
.pane a { color: var(--accent); }
.pane a.btn { color: var(--ink); }

.pane h3.sub { margin: 28px 0 4px; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 19px; }
.pane textarea.field.tall { min-height: 420px; max-width: none; font-family: ui-monospace, Consolas, monospace; font-size: 14px; line-height: 1.5; }
.pane select.field { appearance: auto; }
.count { font-size: 13px; color: var(--muted); margin: -4px 0 8px; }
.entry { border-bottom: 1px solid var(--line); padding: 14px 0; }
.entry h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.entry p { margin: 0 0 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.levelbox { background: var(--bg); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.levelhead { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.levelhead b { font-size: 18px; }
.levelhead span { color: var(--muted); }
.meter { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin-bottom: 10px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.levelbox p { margin: 6px 0 0; }
.media { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.media .card { margin: 0; max-width: none; padding-top: 0; }
.preview { display: block; background: var(--bg); margin: 8px 0 12px; }
.preview.wide { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; }
.preview.round { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; }
.viz { position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 8px 0 20px; --s1: #2a78d6; --s2: #eb6834; }
.vizhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.vizhead h3 { margin: 0; font-size: 16px; font-weight: 600; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--bg); color: var(--ink); font-weight: 600; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin: 10px 0 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.viz .s1 { background: var(--s1); }
.viz .s2 { background: var(--s2); }
.chart { display: flex; gap: 8px; height: 220px; }
.axis { display: flex; flex-direction: column; justify-content: space-between; text-align: right; font-size: 11px; color: var(--muted); padding-bottom: 22px; min-width: 22px; font-variant-numeric: tabular-nums; }
.plot { flex: 1; display: flex; align-items: stretch; gap: 2px; min-width: 0; background: linear-gradient(var(--line), var(--line)) 0 0 / 100% 1px no-repeat, linear-gradient(var(--line), var(--line)) 0 calc((100% - 22px) / 2) / 100% 1px no-repeat, linear-gradient(var(--line), var(--line)) 0 calc(100% - 22px) / 100% 1px no-repeat; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; outline: none; }
.col:hover .stack, .col:focus .stack { background: var(--bg); }
.stack { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.stack i { display: block; width: min(70%, 22px); min-height: 2px; }
.stack i:first-child { border-radius: 4px 4px 0 0; }
.col span { height: 22px; line-height: 22px; font-size: 11px; color: var(--muted); white-space: nowrap; text-align: center; overflow: visible; }
.tip { position: absolute; width: 170px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13px; box-shadow: 0 6px 18px rgba(0, 0, 0, .12); pointer-events: none; z-index: 3; transform: translateY(-100%); }
.tip b, .tip span { display: block; }
.tip span { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) { .viz { --s1: #3987e5; --s2: #d95926; } }
.adv { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 14px; }
.adv summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.adv[open] summary { color: var(--ink); }
.msg .shot { display: block; width: min(100%, 300px); max-height: 340px; object-fit: cover; border-radius: 12px; margin: 0 0 6px; background: #1b1613; }
.msg img.shot { cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 20; background: rgba(15, 10, 8, .9); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.gallery .card { margin: 0; max-width: none; padding: 12px 16px 16px; }
.gallery .preview.wide { margin-top: 4px; }
.ts { margin: 4px 0 10px; display: flex; justify-content: center; min-height: 0; }
.pane .ts { justify-content: flex-start; margin: 10px 0; }
.subtabs { display: flex; gap: 4px; flex-wrap: wrap; margin: -6px -6px 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.subtabs a { padding: 7px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 15px; }
.subtabs a:hover { background: var(--bg); color: var(--ink); }
.subtabs a.on { background: var(--bg); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); }
@media (max-width: 720px) {
  .tabs a { flex-direction: column; gap: 4px; padding: 8px 10px; font-size: 12px; min-width: 68px; text-align: center; }
  .subtabs { flex-wrap: nowrap; overflow-x: auto; margin: -4px -4px 16px; }
  .subtabs a { white-space: nowrap; }
}
.composer { position: relative; padding-left: 8px; }
.composer .attach { background: transparent; color: var(--muted); }
.composer .attach:hover { background: var(--bg); color: var(--ink); filter: none; }
.dock { width: 100%; max-width: 1120px; display: flex; flex-direction: column; gap: 8px; flex: none; }
.dock .composer { max-width: none; }
:fullscreen .dock { max-width: none; }
.above { display: flex; gap: 8px; align-items: flex-end; padding: 0 6px; }
.above:not(:has(> :not([hidden]))) { display: none; }
.draft { position: relative; flex: none; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: none; }
.draft img { display: block; width: 96px; height: 96px; object-fit: cover; border-radius: 10px; }
.draft button { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border: 0; padding: 0; border-radius: 50%; background: var(--ink); color: var(--panel); font-size: 16px; line-height: 1; }
.msg.me .shot { margin-left: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.done td.wrap { text-decoration: line-through; color: var(--muted); }
.replybar { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 12px; box-shadow: 0 8px 24px rgba(60, 35, 15, .18); }
.replybar div { flex: 1; min-width: 0; }
.replybar b { display: block; font-size: 12px; color: var(--accent); }
.replybar span { display: block; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.replybar button { width: 28px; height: 28px; border: 0; border-radius: 50%; padding: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; }
.picker { position: absolute; right: 8px; bottom: calc(100% + 8px); width: min(340px, calc(100vw - 32px)); max-height: 220px; overflow-y: auto; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 24px rgba(60, 35, 15, .18); z-index: 5; }
.picker[hidden] { display: none; }
.composer .picker button { width: auto; height: 36px; background: transparent; border-radius: 8px; font-size: 20px; color: inherit; }
.composer .picker button:hover { background: var(--bg); filter: none; }
.msg { position: relative; cursor: default; }
.msg.reacted { margin-bottom: 12px; }
.msg.flash { outline: 3px solid var(--accent); outline-offset: 2px; }
.quote { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--accent); border-radius: 8px; padding: 5px 8px; margin: 0 0 6px; background: rgba(0, 0, 0, .07); color: inherit; font-size: 13px; cursor: pointer; }
.msg.me .quote { border-left-color: #fff8f0; background: rgba(0, 0, 0, .14); }
.quote b { display: block; font-size: 12px; }
.quote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .85; }
.reacts { position: absolute; bottom: -12px; padding: 1px 7px; border-radius: 999px; background: #fffaf2; color: #2f2620; font-size: 14px; line-height: 20px; box-shadow: 0 1px 6px rgba(0, 0, 0, .25); white-space: nowrap; }
.msg.her .reacts { left: 10px; }
.msg.me .reacts { right: 10px; }
.acts { position: absolute; top: -38px; display: none; gap: 2px; padding: 3px; border-radius: 999px; background: #fffaf2; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); z-index: 4; white-space: nowrap; }
.msg.her .acts { left: 0; }
.msg.me .acts { right: 0; }
.msg.open .acts { display: flex; }
@media (hover: hover) { .msg:hover .acts { display: flex; } }
.acts button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: #2f2620; font-size: 18px; padding: 0; }
.acts button:hover, .acts button.on { background: #f3d9bf; }
.acts svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.replybar[hidden], .draft[hidden] { display: none; }
