/* Nuoga Siela — dizaino sistema.
   Nuotaika: naktis, kai niekas nemato. Gili mėlyna bazė, gintaras ugniai,
   žalsva ramybei. Viskas rašyta ranka, be jokių bibliotekų. */

:root {
  --bg: #0f1420;
  --bg-raised: #161d2e;
  --bg-card: #1a2236;
  --line: #232d45;
  --text: #e8ecf4;
  --text-dim: #8a94ab;
  --amber: #f59e0b;
  --amber-deep: #ef6c00;
  --calm: #7fd1c1;
  --calm-deep: #3fa796;
  --danger: #e5484d;

  --emo-pyktis: #e5484d;
  --emo-liudesys: #5b8def;
  --emo-nerimas: #b07ce8;
  --emo-kalte: #c98a5b;
  --emo-vienatve: #6b7a99;
  --emo-viltis: #7fd1c1;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --tabbar-h: 64px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* `hidden` atributas turi nugalėti bet kokį display iš klasių
   (pvz., .scream-actions ir .hug-banner nustato display, tad be šito
   liktų matomi net su hidden). */
[hidden] {
  display: none !important;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 80% -10%, #182138 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #131b2c 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 16px calc(var(--tabbar-h) + 20px);
}

/* ---------- Viršus ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 2px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
  font-weight: 650;
  letter-spacing: 0.4px;
  font-size: 17px;
}

.brand-flame {
  width: 22px;
  height: 22px;
  fill: var(--amber);
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.45));
}

.sos-btn {
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 7px 14px;
  border: 1px solid rgba(229, 72, 77, 0.55);
  border-radius: 999px;
  background: rgba(229, 72, 77, 0.10);
  transition: background 0.2s, box-shadow 0.2s;
}
.sos-btn:hover {
  background: rgba(229, 72, 77, 0.22);
  box-shadow: 0 0 14px rgba(229, 72, 77, 0.25);
}

/* ---------- Ekranai ---------- */

.screens {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.screen {
  animation: screen-in 0.28s ease both;
  padding-top: 8px;
}
.screen[hidden] {
  display: none;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

h1 {
  font-size: 22px;
  font-weight: 650;
}
h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.muted {
  color: var(--text-dim);
  font-size: 14px;
}

/* ---------- Rašymo ekranas ---------- */

.promise {
  color: var(--text-dim);
  font-size: 13.5px;
  letter-spacing: 0.2px;
  text-align: center;
  margin: 6px 0 14px;
  font-style: italic;
}

.write-area {
  position: relative;
}

#write-input {
  width: 100%;
  min-height: 34vh;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  line-height: 1.65;
  padding: 18px;
  resize: none;
  outline: none;
  caret-color: var(--amber);
  transition: border-color 0.25s, box-shadow 0.25s;
}
#write-input:focus {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.08);
}
#write-input::placeholder {
  color: #55607a;
}

#burn-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border-radius: var(--radius);
}

.write-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.char-count {
  color: #55607a;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

/* Emocijos */

.emotions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.emo {
  --dot: var(--text-dim);
  font: inherit;
  font-size: 12.5px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px 5px 22px;
  cursor: pointer;
  position: relative;
  transition: all 0.18s;
}
.emo::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot);
  opacity: 0.85;
}
.emo[data-emotion="pyktis"] {
  --dot: var(--emo-pyktis);
}
.emo[data-emotion="liudesys"] {
  --dot: var(--emo-liudesys);
}
.emo[data-emotion="nerimas"] {
  --dot: var(--emo-nerimas);
}
.emo[data-emotion="kalte"] {
  --dot: var(--emo-kalte);
}
.emo[data-emotion="vienatve"] {
  --dot: var(--emo-vienatve);
}
.emo[data-emotion="viltis"] {
  --dot: var(--emo-viltis);
}

.emo.is-active {
  color: var(--text);
  border-color: var(--dot);
  box-shadow: 0 0 10px color-mix(in srgb, var(--dot) 35%, transparent);
}

/* Mygtukai */

.write-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s, box-shadow 0.2s, opacity 0.2s;
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.btn-icon {
  font-size: 17px;
}

.btn-burn {
  flex: 1;
  color: #1a0e00;
  background: linear-gradient(135deg, var(--amber) 0%, var(--amber-deep) 100%);
  box-shadow: 0 4px 18px rgba(239, 108, 0, 0.30);
}
.btn-burn:hover:not(:disabled) {
  box-shadow: 0 4px 26px rgba(239, 108, 0, 0.50);
}

.btn-release {
  flex: 1.4;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--line);
}
.btn-release:hover:not(:disabled) {
  border-color: var(--calm-deep);
  box-shadow: 0 0 14px rgba(127, 209, 193, 0.15);
}

.btn-calm {
  color: #062019;
  background: linear-gradient(135deg, var(--calm) 0%, var(--calm-deep) 100%);
}

.btn-danger {
  color: #fff;
  background: rgba(229, 72, 77, 0.15);
  border: 1px solid rgba(229, 72, 77, 0.5);
}
.btn-danger:hover {
  background: rgba(229, 72, 77, 0.3);
}

.write-hint {
  color: #55607a;
  font-size: 12.5px;
  margin: 14px 0 10px;
  text-align: center;
}

/* ---------- Srautas ---------- */

.feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.refresh {
  font: inherit;
  font-size: 18px;
  color: var(--text-dim);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  cursor: pointer;
  transition: transform 0.4s, color 0.2s;
}
.refresh:hover {
  color: var(--calm);
}
.refresh.is-spinning {
  transform: rotate(360deg);
}

.feed-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: none;
}
.feed-filters::-webkit-scrollbar {
  display: none;
}

.chip {
  font: inherit;
  font-size: 12.5px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s;
}
.chip.is-active {
  color: var(--text);
  background: var(--bg-card);
  border-color: #35415f;
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  --emo: var(--text-dim);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--emo);
  border-radius: var(--radius);
  padding: 16px 16px 12px;
  box-shadow: var(--shadow);
  animation: screen-in 0.3s ease both;
}
.card[data-emotion="pyktis"] {
  --emo: var(--emo-pyktis);
}
.card[data-emotion="liudesys"] {
  --emo: var(--emo-liudesys);
}
.card[data-emotion="nerimas"] {
  --emo: var(--emo-nerimas);
}
.card[data-emotion="kalte"] {
  --emo: var(--emo-kalte);
}
.card[data-emotion="vienatve"] {
  --emo: var(--emo-vienatve);
}
.card[data-emotion="viltis"] {
  --emo: var(--emo-viltis);
}

.card-text {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  font-size: 15.5px;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 10px;
}

.hug {
  font: inherit;
  font-size: 13.5px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s;
}
.hug:hover {
  border-color: var(--calm-deep);
  color: var(--text);
}
.hug.is-hugged {
  color: #062019;
  background: linear-gradient(135deg, var(--calm) 0%, var(--calm-deep) 100%);
  border-color: transparent;
}
.hug-count {
  font-variant-numeric: tabular-nums;
}

.card-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-left {
  font-size: 11.5px;
  color: #55607a;
  font-variant-numeric: tabular-nums;
}

.report {
  font: inherit;
  color: #55607a;
  background: none;
  border: none;
  font-size: 17px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.report:hover {
  color: var(--danger);
  background: rgba(229, 72, 77, 0.08);
}

/* Likusio laiko juosta — "smilkstantis dagtis" kortelės apačioje */
.fuse {
  height: 2px;
  margin: 10px -16px -12px;
  border-radius: 0 0 var(--radius) var(--radius);
  background: linear-gradient(90deg, var(--amber-deep), var(--amber));
  opacity: 0.55;
  transform-origin: left;
}

.feed-empty {
  text-align: center;
  padding: 60px 20px;
}
.feed-empty p:first-child {
  font-size: 17px;
  margin-bottom: 6px;
}

/* ---------- SOS ---------- */

.sos-title {
  margin-bottom: 6px;
}

.hotlines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0 28px;
}

.hotline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.hotline:hover {
  border-color: var(--calm-deep);
  box-shadow: 0 0 16px rgba(127, 209, 193, 0.12);
}
.hotline-name {
  font-size: 13px;
  color: var(--text-dim);
}
.hotline-number {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--calm);
}
.hotline-note {
  font-size: 12px;
  color: #55607a;
}
.hotline.compact {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.hotline.compact .hotline-number {
  font-size: 17px;
}

/* Kvėpavimo ratas */

.breathe-block {
  text-align: center;
  padding-bottom: 20px;
}

.breathe-stage {
  position: relative;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0 18px;
}

.breathe-circle {
  position: absolute;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 35% 30%,
    rgba(127, 209, 193, 0.55),
    rgba(63, 167, 150, 0.25) 65%
  );
  border: 1px solid rgba(127, 209, 193, 0.4);
  box-shadow: 0 0 40px rgba(127, 209, 193, 0.18);
  transform: scale(0.8);
}
.breathe-circle.is-breathing-in {
  transition: transform 4s cubic-bezier(0.4, 0, 0.4, 1);
  transform: scale(1.6);
}
.breathe-circle.is-breathing-out {
  transition: transform 6s cubic-bezier(0.4, 0, 0.4, 1);
  transform: scale(0.8);
}

.breathe-label {
  position: relative;
  font-size: 15px;
  color: var(--text);
  z-index: 1;
}

/* ---------- Nustatymai ---------- */

.setting {
  margin: 18px 0;
}
.setting label {
  display: block;
  color: var(--text-dim);
  font-size: 13.5px;
  margin-bottom: 6px;
}
.setting select {
  font: inherit;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  width: 100%;
}
.setting-danger {
  margin-top: 30px;
}
.setting-danger .muted {
  margin-top: 8px;
}

.privacy {
  margin-top: 30px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.privacy p {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 10px;
}
.privacy .promise {
  text-align: left;
  margin: 14px 0 0;
  color: var(--calm);
}

/* ---------- Apatinis meniu ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  justify-content: center;
  gap: 4px;
  background: rgba(15, 20, 32, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  z-index: 10;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 92px;
  color: #55607a;
  text-decoration: none;
  font-size: 11.5px;
  transition: color 0.2s;
}
.tab-icon {
  font-size: 19px;
  line-height: 1;
}
.tab.is-active {
  color: var(--amber);
}
.tab:hover {
  color: var(--text);
}

/* ---------- Toast + SOS sheet ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 18px);
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 30;
  max-width: 90vw;
  text-align: center;
  animation: toast-in 0.25s ease;
}
.toast.toast-calm {
  border-color: var(--calm-deep);
}
.toast.toast-warn {
  border-color: rgba(229, 72, 77, 0.6);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.sos-sheet {
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 18, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
}
.sos-sheet[hidden] {
  display: none;
}

.sos-sheet-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px));
  max-width: 640px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: sheet-in 0.3s ease;
}
.sos-sheet-card p {
  font-size: 14.5px;
  color: var(--text-dim);
}

@keyframes sheet-in {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* ---------- v1.1: istorijos, banneris, parama ---------- */

.social-proof {
  text-align: center;
  color: var(--calm);
  font-size: 12.5px;
  margin: -6px 0 12px;
  opacity: 0.85;
}

.hug-banner {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  text-align: center;
  background: linear-gradient(135deg, rgba(127, 209, 193, 0.14), rgba(63, 167, 150, 0.08));
  border: 1px solid rgba(127, 209, 193, 0.35);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin-bottom: 12px;
  cursor: pointer;
  animation: screen-in 0.4s ease both;
}
.hug-banner:hover {
  border-color: var(--calm);
}

.lifespan {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}
.lifespan .chip {
  flex: 1;
  padding: 8px 10px;
  text-align: center;
}
.lifespan .chip.is-active {
  color: var(--text);
  border-color: var(--calm-deep);
  background: rgba(127, 209, 193, 0.08);
}

.screen-intro {
  margin-bottom: 12px;
}

.expand {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--calm);
  background: none;
  border: none;
  padding: 8px 0 0;
  cursor: pointer;
}
.expand:hover {
  text-decoration: underline;
}

.empty-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--calm);
  font-size: 14px;
  text-decoration: none;
}
.empty-link:hover {
  text-decoration: underline;
}

.support {
  margin-top: 30px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.support .muted {
  margin-bottom: 12px;
}

.btn-support {
  text-decoration: none;
  color: #1a0e00;
  background: linear-gradient(135deg, #ffd28a 0%, var(--amber) 100%);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.2);
}

/* Jungiklis (switch) */

.setting-toggle .muted {
  margin-top: 6px;
}

.setting label.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  position: relative;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.2s, background 0.2s;
}

.toggle input:checked + .toggle-track {
  background: rgba(127, 209, 193, 0.2);
  border-color: var(--calm-deep);
}

.toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
  background: var(--calm);
}

.toggle-text {
  font-size: 15px;
  color: var(--text);
}

/* ---------- Šauksmo kambarys ---------- */

.scream-link {
  display: block;
  text-align: center;
  margin: 18px 0 4px;
  color: var(--text-dim);
  font-size: 13.5px;
  text-decoration: none;
  transition: color 0.2s;
}
.scream-link:hover {
  color: var(--amber);
}

.scream-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 40px 0 20px;
}

.scream-orb {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: radial-gradient(
    circle at 35% 30%,
    rgba(245, 158, 11, 0.35),
    rgba(239, 108, 0, 0.15) 65%
  );
  box-shadow: 0 0 50px rgba(239, 108, 0, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.3s;
}
.scream-orb:active {
  transform: scale(0.96);
}
.scream-orb-icon {
  font-size: 54px;
  line-height: 1;
}

.scream-orb.is-recording {
  border-color: var(--danger);
  background: radial-gradient(
    circle at 35% 30%,
    rgba(229, 72, 77, 0.5),
    rgba(229, 72, 77, 0.15) 65%
  );
  animation: scream-pulse 1.1s ease-in-out infinite;
}

.scream-orb.is-ready {
  border-color: var(--calm-deep);
  background: radial-gradient(
    circle at 35% 30%,
    rgba(127, 209, 193, 0.35),
    rgba(63, 167, 150, 0.12) 65%
  );
  box-shadow: 0 0 40px rgba(127, 209, 193, 0.18);
}

@keyframes scream-pulse {
  0%,
  100% {
    box-shadow: 0 0 40px rgba(229, 72, 77, 0.25);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 70px rgba(229, 72, 77, 0.55);
    transform: scale(1.05);
  }
}

.scream-status {
  color: var(--text-dim);
  font-size: 15px;
  text-align: center;
  max-width: 320px;
}

.scream-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.scream-actions .btn {
  flex: 1;
  max-width: 200px;
}

/* ---------- Judesio mažinimas ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 420px) {
  .write-actions {
    flex-direction: column;
  }
  .btn-release {
    flex: 1;
  }
}
