/* aqualley studio: follows the Telegram theme (the --tg-theme-* variables Telegram's script sets), with light and
   dark fallbacks for a browser. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #16181d);
  --hint: var(--tg-theme-hint-color, #5f6672);
  --link: var(--tg-theme-link-color, #1f6fd1);
  --button: var(--tg-theme-button-color, #1f6fd1);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --surface: var(--tg-theme-secondary-bg-color, #f1f3f6);
  --section: var(--tg-theme-section-bg-color, #ffffff);
  --accent: var(--tg-theme-accent-text-color, #1f6fd1);
  --danger: var(--tg-theme-destructive-text-color, #c62f2f);
  --line: color-mix(in srgb, var(--text) 14%, transparent);
  --ok: #1d7f45;
  --warn: #9a5b00;
  --radius: 14px;
  --gap: 12px;
  --tap: 44px;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--surface);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-tg]) {
    --bg: #17191d; --text: #eceef2; --hint: #a3a9b4; --link: #6aa8ff; --button: #3b82f6; --surface: #0f1114;
    --section: #1b1e23; --accent: #6aa8ff; --danger: #ff7b7b; --ok: #4ccb7f; --warn: #f0b45a;
  }
}
:root[data-dark] { --ok: #4ccb7f; --warn: #f0b45a; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--surface); padding-bottom: env(safe-area-inset-bottom); }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--link); }
img, video { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 8px 16px 0; padding-top: max(8px, env(safe-area-inset-top)); }
.top-row { display: flex; align-items: center; gap: 8px; }
h1 { font-size: 18px; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { width: var(--tap); height: var(--tap); border: 0; border-radius: 50%; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--hint); }
.icon-button svg { width: 22px; height: 22px; }
.icon-button:hover { background: var(--surface); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 4px -4px 0; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { position: relative; flex: 1 1 0; min-width: 0; min-height: 48px; padding: 0 2px; border: 0;
  background: transparent; border-bottom: 3px solid transparent; color: var(--hint); font-weight: 600;
  font-size: 15px; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.count:not(:empty) { position: absolute; top: 0; right: 0; min-width: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--button); color: var(--button-text); font-size: 11px; line-height: 18px; text-align: center; }

main { padding: 12px 16px 96px; max-width: 1280px; margin: 0 auto; outline: none; }
.empty { color: var(--hint); text-align: center; padding: 40px 12px; }
.bar { background: var(--section); border-radius: var(--radius); padding: 12px 14px; margin-bottom: var(--gap);
  display: grid; gap: 10px; }
.bar h2 { font-size: 16px; margin: 0; }
.bar .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hint { color: var(--hint); font-size: 14px; margin: 0; }
.notice { border-left: 4px solid var(--warn); }
.grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid.ideas { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid.ideas { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.card { background: var(--section); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px;
  align-content: start; border: 1px solid transparent; }
.card.decided { border-color: var(--line); }
.card-head { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.pill { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 13px;
  font-size: 13px; font-weight: 600; background: var(--surface); }
.pill.ok { color: var(--ok); }
.pill.no { color: var(--danger); }
.pill.wait { color: var(--warn); }
.meta { color: var(--hint); font-size: 14px; }
.ref { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: start; }
.ref img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; background: var(--surface); }
.ref .meta { margin: 0; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumbs img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; background: var(--surface); }
.field { display: grid; gap: 4px; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--hint); }
textarea, input[type="text"], input[type="url"], input[type="datetime-local"], select {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); resize: vertical; }
textarea { min-height: 44px; overflow: hidden; }
.saved { font-size: 12px; color: var(--ok); min-height: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { min-height: var(--tap); padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; text-decoration: none; color: var(--text); }
.btn.primary { background: var(--button); color: var(--button-text); border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn svg { width: 18px; height: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line); background: var(--bg);
  cursor: pointer; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--button); color: var(--button-text); border-color: transparent; }
.reject-box, .feedback-box, .move-box, .posted-box { display: grid; gap: 8px; padding: 10px; border-radius: 12px;
  background: var(--surface); }
[hidden] { display: none !important; }

.video-card { display: grid; gap: 12px; }
.video-body { display: grid; gap: 10px; align-content: start; }
@media (min-width: 720px) { .video-card { grid-template-columns: minmax(240px, 360px) 1fr; } }
.player { background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 9 / 16; height: min(62vh, 640px);
  width: auto; max-width: 100%; justify-self: center; }
.player video { width: 100%; height: 100%; object-fit: contain; }
.check img { border-radius: 10px; width: 100%; background: var(--surface); }
.check ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.check .pass { color: var(--ok); }
.check .reject, .check .failed { color: var(--danger); }
.feedback-list { margin: 0; padding-left: 18px; font-size: 14px; }
.at { font-variant-numeric: tabular-nums; font-weight: 600; }

.day { margin: 16px 0 8px; font-size: 15px; }
.post { display: grid; grid-template-columns: 72px 1fr; gap: 12px; background: var(--section);
  border-radius: var(--radius); padding: 12px; margin-bottom: 8px; }
.post img { width: 72px; height: 128px; object-fit: cover; border-radius: 8px; background: var(--surface); }
.post .copy { display: flex; gap: 8px; align-items: flex-start; }
.post .copy p { margin: 0; flex: 1; font-size: 14px; white-space: pre-wrap; word-break: break-word; }

.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.tile { background: var(--section); border-radius: 12px; overflow: hidden; display: grid; }
.tile img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface); }
.tile .body { padding: 8px 10px; display: grid; gap: 6px; font-size: 13px; }
.tile .actions .btn { min-height: 40px; padding: 0 10px; flex: 1; }
.gaps .chip { cursor: default; }
.category { margin: 18px 0 8px; font-size: 15px; }

.progress { height: 6px; border-radius: 3px; background: var(--surface); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--button); transition: width .2s; }
#toast { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px;
  max-width: calc(100% - 32px); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 10; }
#toast.show { opacity: 1; }

.posting { position: fixed; inset: 0; z-index: 8; background: var(--surface); overflow-y: auto;
  padding: max(12px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
.posting-body { max-width: 560px; margin: 0 auto; display: grid; gap: 12px; background: var(--section);
  border-radius: var(--radius); padding: 16px; }
.posting-body .card-head .icon-button { margin-left: auto; }
.posting-poster { width: 160px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 12px; justify-self: center;
  background: var(--surface); }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 14px; }
.steps li { padding-left: 4px; }
.steps li > .btn { width: 100%; }
.steps .actions { margin-top: 8px; }
@media (min-width: 600px) { .count:not(:empty) { position: static; margin-left: 6px; vertical-align: 1px; } }
