:root {
  color-scheme: dark;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #edf8f2;
  background: #080b0f;
  --ink: #edf8f2;
  --muted: #91a3a8;
  --line: #293640;
  --surface: #11181d;
  --canvas: #080b0f;
  --blue: #61f5df;
  --blue-soft: #102d31;
  --green: #b8ff4a;
  --green-soft: #162c1c;
  --red: #ff6b8e;
  --red-soft: #321925;
  --magenta: #f05bc8;
  --radius: 4px;
}

* { box-sizing: border-box; }

html:not([data-telegram-app="true"]) .app { display: none; }

.browser-block {
  display: none;
  place-items: center;
  gap: 10px;
  min-height: 100vh;
  padding: 24px;
  color: var(--ink);
  background: var(--canvas);
  text-align: center;
}

.browser-block strong { color: var(--blue); font-size: 18px; }
.browser-block span { max-width: 420px; color: var(--muted); }
html:not([data-telegram-app="true"]) .browser-block { display: grid; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background-color: var(--canvas);
  background-image: repeating-linear-gradient(0deg, #ffffff05 0 1px, transparent 1px 5px), linear-gradient(90deg, #61f5df08 1px, transparent 1px 72px);
}

body::before {
  position: fixed;
  z-index: 20;
  inset: 0;
  pointer-events: none;
  content: "";
  background: repeating-linear-gradient(180deg, transparent 0 3px, #ffffff08 3px 4px);
  opacity: .35;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }

.app {
  position: relative;
  z-index: 1;
  width: min(100%, 1040px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 24px 18px;
  display: flex;
  flex-direction: column;
}

.app > header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 90px;
  padding: 16px 0;
  border-bottom: 1px solid #31515a;
}

.app > header::before {
  content: "";
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  background: url("/kirka-logo.png") center / contain no-repeat;
  filter: drop-shadow(3px 0 0 #f05bc855) drop-shadow(-3px 0 0 #61f5df55);
}

.app > header::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  width: 68px;
  height: 2px;
  content: "";
  background: var(--magenta);
  box-shadow: -22px 0 var(--blue), -46px 0 var(--green);
  opacity: .9;
}

.kicker, .eyebrow {
  color: var(--blue);
  font-size: 11px;
  font-weight: 750;
}

.app > header h1 {
  margin: 3px 0 4px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.2;
  font-weight: 700;
  text-shadow: 2px 0 #f05bc866, -2px 0 #61f5df66;
}

.app > header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.app > header button {
  width: 38px;
  height: 38px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101b20;
  color: var(--blue);
  box-shadow: 3px 3px 0 #f05bc844;
  font-size: 21px;
  cursor: pointer;
}

nav {
  display: flex;
  gap: 4px;
  min-height: 48px;
  overflow-x: auto;
  border-bottom: 1px solid #293f48;
  scrollbar-width: thin;
}

nav button {
  position: relative;
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

nav button.active { color: var(--blue); }
nav button.active::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 2px;
  background: var(--green);
  box-shadow: 10px 0 0 var(--magenta), -10px 0 0 var(--blue);
}

.app main {
  flex: 1;
  min-height: 500px;
  padding: 30px 0 36px;
}

main > section:not(.active) { display: none; }
main > section[hidden] { display: none !important; }

.head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

h2 {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 23px;
  line-height: 1.25;
  font-weight: 700;
  text-shadow: 1px 0 #f05bc855, -1px 0 #61f5df55;
}

h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 16px;
}

.primary, .secondary, .danger {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.primary {
  background: var(--green);
  border-color: #d4ff85;
  color: #071008;
  box-shadow: 3px 3px 0 #f05bc866;
}

.primary:hover { background: #caff6d; box-shadow: 1px 1px 0 #f05bc866; transform: translate(2px, 2px); }

.secondary {
  border-color: var(--line);
  background: #111a1f;
  color: #d2e4df;
}

.secondary:hover { border-color: var(--blue); background: #15252a; color: var(--blue); }

.danger {
  border-color: #713044;
  background: var(--red-soft);
  color: var(--red);
}

.danger:hover { border-color: var(--red); background: #4a2030; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 760px;
}

.stats > div {
  min-height: 82px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #121d22, #0d1317);
  box-shadow: inset 3px 0 var(--blue), 4px 4px 0 #00000055;
}

.stats small, .list-item small, .news-item small {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.stats b { color: var(--ink); font-size: 20px; }

.bound {
  display: flex;
  align-items: center;
  gap: 11px;
  max-width: 760px;
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid #355c43;
  border-radius: var(--radius);
  background: #102319;
  box-shadow: 4px 4px 0 #00000055;
}

.bound i {
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #21936d;
}

.bound small { display: block; margin-top: 4px; color: var(--muted); }

form { display: grid; gap: 14px; max-width: 760px; margin-top: 20px; }

label {
  display: grid;
  gap: 7px;
  color: #b8cbc5;
  font-size: 13px;
  font-weight: 600;
}

input, textarea, select {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid #34454e;
  border-radius: var(--radius);
  outline: none;
  background: #0e1519;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px #ffffff05;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--blue);
  box-shadow: 3px 3px 0 #f05bc855, 0 0 0 3px #61f5df18;
}

input[type="file"] { padding: 7px; }

textarea {
  min-height: 190px;
  resize: vertical;
  line-height: 1.55;
  font-weight: 450;
  tab-size: 2;
}

.hint { color: var(--muted); font-size: 12px; font-weight: 450; }

.editor-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.editor-count { color: var(--muted); font-size: 12px; font-weight: 450; }

.format-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: #0b1216;
  box-shadow: inset 0 -2px 0 var(--magenta);
}

.editor-tool {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #b5d5ce;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.editor-tool:hover, .editor-tool:focus-visible {
  border-color: var(--blue);
  outline: none;
  background: #17262b;
  color: var(--blue);
}

.format-toolbar + textarea {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.media-options { display: grid; gap: 4px; margin-top: -4px; }
.check-control { display: inline-flex; align-items: center; gap: 8px; width: fit-content; color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; }
.check-control input { width: 16px; min-height: 16px; margin: 0; accent-color: var(--green); box-shadow: none; }
.quality-control { display: inline-flex; align-items: center; gap: 8px; width: fit-content; color: var(--ink); font-size: 13px; font-weight: 600; }
.quality-control select { width: auto; min-width: 92px; min-height: 34px; padding: 6px 28px 6px 9px; }
.quality-control select:disabled { cursor: not-allowed; opacity: .55; }
.media-list { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 450; }
.media-list:empty { display: none; }
.media-list > b { color: var(--ink); font-size: 13px; }
.media-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px; background: #0e171b; box-shadow: 2px 2px 0 #00000066; }
.media-item-info { min-width: 0; overflow-wrap: anywhere; }
.media-item-name { display: block; overflow: hidden; color: var(--ink); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.media-item-size { color: var(--muted); }
.media-remove { display: inline-grid; flex: 0 0 28px; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--red); font-size: 18px; line-height: 1; cursor: pointer; }
.media-remove:hover, .media-remove:focus-visible { border-color: var(--red); outline: none; background: var(--red-soft); }
.drop-active { outline: 2px dashed var(--green); outline-offset: 3px; }

.list-item, .news-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #10181d;
  box-shadow: 4px 4px 0 #00000055;
}

.list-item b, .list-item small, .news-item b, .news-item small { display: block; }
.list-item small { max-width: 560px; margin-top: 4px; overflow-wrap: anywhere; }
.feed-actions, .news-actions { display: flex; flex: 0 0 auto; gap: 7px; align-items: center; }
.feed-actions button, .news-actions button, .news-actions a { white-space: nowrap; }
.source-link { display: inline-grid; place-items: center; text-decoration: none; }
.news-item p { margin: 8px 0 0; color: #b0c2c1; line-height: 1.5; }
.news-media { display: block; width: min(360px, 100%); max-height: 220px; object-fit: cover; margin-bottom: 10px; border-radius: 4px; }
.media-note { display: inline-block; margin-bottom: 8px; padding: 4px 8px; border-radius: 4px; background: #332b14; color: #e2d26f; font-size: 12px; font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.box { min-height: 150px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #10181d; box-shadow: 4px 4px 0 #00000055; }
.box form { display: flex; gap: 8px; margin-top: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; margin: 3px; padding: 6px 9px; border: 1px solid #2d6e76; border-radius: 16px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 600; }
.chip button { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--red); cursor: pointer; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; min-height: 38px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: #10181d; color: #b0c2c1; cursor: pointer; }
.seg button.active { border-color: var(--green); background: var(--green-soft); color: var(--green); box-shadow: 2px 2px 0 #f05bc855; }

button:disabled { opacity: .58; cursor: wait; }
button:focus-visible, a:focus-visible { outline: 3px solid #61f5df88; outline-offset: 2px; }

#toast {
  position: fixed;
  z-index: 10;
  right: 16px;
  bottom: 16px;
  left: 16px;
  width: fit-content;
  max-width: min(520px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 10px 14px;
  border: 1px solid #31515a;
  border-radius: var(--radius);
  background: #121d22;
  color: var(--ink);
  box-shadow: 4px 4px 0 #f05bc866, 0 8px 24px #00000066;
  font-size: 13px;
}

#toast:empty { display: none; }

.app > footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 0;
  border-top: 1px solid #293f48;
  color: var(--muted);
  font-size: 12px;
}

.footer-status { display: inline-flex; align-items: center; gap: 8px; color: var(--green); }
.footer-gif { display: block; width: 42px; height: 26px; border: 1px solid #52723a; border-radius: 4px; background: var(--green-soft); object-fit: cover; opacity: .9; box-shadow: 2px 2px 0 #f05bc855; }

@media (max-width: 680px) {
  .app { padding: 0 14px 14px; }
  .app > header { min-height: 78px; gap: 10px; }
  .app > header::before { flex-basis: 38px; width: 38px; height: 38px; }
  .app > header h1 { font-size: 20px; }
  .app > header p { font-size: 12px; }
  .app > header button { width: 36px; height: 36px; }
  nav { margin-right: -14px; margin-left: -14px; padding: 0 8px; }
  nav button { padding: 0 12px; }
  .app main { min-height: 440px; padding: 22px 0 30px; }
  .head { align-items: stretch; flex-direction: column; gap: 12px; }
  .head .primary { width: 100%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stats > div { min-height: 72px; padding: 12px; }
  .stats > div:last-child { grid-column: 1 / -1; }
  .grid { grid-template-columns: 1fr; }
  .list-item, .news-item { align-items: stretch; flex-direction: column; gap: 10px; padding: 13px; }
  .feed-actions, .news-actions { width: 100%; flex-wrap: wrap; }
  .feed-actions button, .news-actions button, .news-actions a { flex: 1 1 auto; }
  .format-toolbar { gap: 2px; }
  .editor-tool { width: 32px; }
  .box form { align-items: stretch; flex-direction: column; }
  .box form input, .box form button { width: 100%; }
  .app > footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition-duration: .01ms !important; }
}

@media (prefers-reduced-motion: no-preference) {
  .app > header h1 { animation: glitch-pulse 8s steps(1, end) infinite; }
}

@keyframes glitch-pulse {
  0%, 91%, 100% { transform: translate(0); text-shadow: 2px 0 #f05bc866, -2px 0 #61f5df66; }
  92% { transform: translate(2px, -1px); text-shadow: -3px 0 var(--magenta), 3px 0 var(--blue); }
  93% { transform: translate(-2px, 1px); text-shadow: 3px 0 var(--magenta), -3px 0 var(--blue); }
  94% { transform: translate(0); text-shadow: 2px 0 #f05bc866, -2px 0 #61f5df66; }
}


:root {
  color-scheme: light;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: #23384b;
  background: #8dbdd8;
  --ink: #23384b;
  --muted: #5f7180;
  --line: #a2bfd4;
  --surface: #f7fbfe;
  --canvas: #8dbdd8;
  --blue: #2f78b8;
  --blue-dark: #1d568d;
  --blue-soft: #dceffc;
  --green: #4f8d3a;
  --green-soft: #e4f0de;
  --red: #a13e43;
  --red-soft: #f8e6e6;
  --magenta: #dfa52f;
  --radius: 3px;
}

body {
  background-color: var(--canvas);
  background-image: linear-gradient(180deg, rgba(255,255,255,.55), transparent 28%), linear-gradient(0deg, rgba(75,145,87,.22) 0 16%, transparent 16%);
}

body::before { display: none; }
.browser-block { background: #e8f3fa; }
.browser-block strong { color: var(--blue-dark, #1d568d); }
.app {
  width: min(1220px, 100%);
  min-height: min(900px, calc(100vh - 48px));
  margin: 24px auto;
  padding: 0 24px 18px;
  overflow: hidden;
  border: 1px solid #6f9ab8;
  border-radius: 8px;
  background: rgba(247, 251, 254, .94);
  box-shadow: 0 20px 50px rgba(33,72,101,.28), 0 2px 5px rgba(24,49,71,.2);
}
.app > header {
  min-height: 76px;
  margin: 0 -24px;
  padding: 12px 20px;
  border-bottom: 1px solid #245a88;
  color: #fff;
  background: linear-gradient(180deg, #54a4db, #296fad);
  text-shadow: 0 1px 2px rgba(0,35,72,.7);
}
.app > header::before { background-image: url("/kirka-live-logo.jpg"); filter: none; }
.app > header::after { display: none; }
.app > header h1 { color: #fff; text-shadow: none; animation: none; }
.app > header p { color: rgba(255,255,255,.86); }
.kicker, .eyebrow { color: #286da7; }
.app > header .kicker { color: #eaf7ff; }
nav { border-bottom-color: #bfd4e2; background: rgba(227,241,250,.72); }
nav button { color: #5f7180; }
nav button.active { color: #1d568d; }
nav button.active::after { background: #2f78b8; box-shadow: none; }
.app main { padding-top: 24px; }
h2 { text-shadow: none; }
.primary {
  border: 1px solid #759ab4;
  color: #234963;
  background: linear-gradient(#fff, #d8eaf5);
  box-shadow: inset 0 1px rgba(255,255,255,.9), 0 1px 2px rgba(40,75,99,.18);
}
.primary:hover { background: linear-gradient(#fff, #c9e0ef); box-shadow: inset 0 1px rgba(255,255,255,.9), 0 1px 2px rgba(40,75,99,.18); transform: none; }
.secondary { border-color: #8aaac1; color: #315168; background: linear-gradient(#fff, #e5f0f7); }
.secondary:hover { border-color: #6093b4; color: #1d568d; background: #eaf5fb; }
.danger { border-color: #d3a3a3; color: #8b3238; background: #faeeee; }
.danger:hover { border-color: #b97070; background: #f8e1e1; }
.stats > div, .list-item, .news-item, .box { border-color: var(--line); background: #f7fbfe; box-shadow: 0 1px 2px rgba(40,75,99,.12); }
.stats > div { box-shadow: inset 3px 0 #2f78b8, 0 1px 2px rgba(40,75,99,.12); }
.bound { border-color: #9fc49a; background: #eff7eb; box-shadow: 0 1px 2px rgba(40,75,99,.12); }
.bound small, .news-item p { color: var(--muted); }
label { color: #315168; }
input, textarea, select { border-color: #8aaac1; color: var(--ink); background: #fff; box-shadow: inset 0 1px 2px rgba(37,73,101,.12); }
input:focus, textarea:focus, select:focus { border-color: #2f78b8; box-shadow: 0 0 0 2px rgba(47,120,184,.15); }
.format-toolbar { border-color: var(--line); background: #eaf4fa; box-shadow: inset 0 -2px #dfa52f; }
.editor-tool { color: #315168; }
.editor-tool:hover, .editor-tool:focus-visible { border-color: #8fb6cf; background: #fff; color: #1d568d; }
.media-item { border-color: var(--line); background: #f7fbfe; box-shadow: 0 1px 2px rgba(40,75,99,.12); }
.media-remove { color: #a13e43; }
.media-remove:hover, .media-remove:focus-visible { border-color: #d3a3a3; background: #f8e6e6; }
.drop-active { outline-color: #4f8d3a; }
.news-item p { color: var(--muted); }
.media-note { background: #fff4d9; color: #75520e; }
.chip { border-color: #a2bfd4; border-radius: 3px; background: #eaf4fa; color: #315168; }
.chip button { color: #a13e43; }
.seg button { border-color: #a2bfd4; color: #315168; background: linear-gradient(#fff, #e5f0f7); }
.seg button.active { border-color: #6f9ab8; color: #1d568d; background: #dceffc; box-shadow: inset 0 1px rgba(255,255,255,.9); }
button:focus-visible, a:focus-visible { outline-color: rgba(47,120,184,.55); }
#toast { border-color: #8aaac1; background: #f7fbfe; color: var(--ink); box-shadow: 0 4px 16px rgba(33,72,101,.22); }
.app > footer { border-top-color: #bfd4e2; }
.footer-status { color: #4f8d3a; }
.footer-gif { border-color: #b2cddd; background: #e4f0de; box-shadow: none; }

@media (max-width: 680px) {
  .app { width: 100%; min-height: 100vh; margin: 0; padding: 0 14px 14px; border: 0; border-radius: 0; box-shadow: none; }
  .app > header { margin: 0 -14px; padding: 12px 14px; }
}
