:root {
  --bg: var(--tg-theme-bg-color, #000);
  --text: var(--tg-theme-text-color, #fff);
  --hint: var(--tg-theme-hint-color, #9aa4ad);
  --btn: var(--tg-theme-button-color, #3390ec);
  --btn-text: var(--tg-theme-button-text-color, #fff);
}

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

html,
body {
  height: 100%;
  background: #000;
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

#feed {
  height: 100vh;
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
}

.reel {
  position: relative;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.reel video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
}

.title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
}

.desc {
  font-size: 13px;
  color: #dcdcdc;
  margin-bottom: 12px;
  max-height: 3.6em;
  overflow: hidden;
}

.watch {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 12px;
  background: var(--btn);
  color: var(--btn-text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.watch:disabled {
  opacity: 0.55;
}

.muted-badge {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.sub-pill {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  background: var(--btn);
  color: var(--btn-text);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  white-space: nowrap;
}

.sub-pill.active {
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}

.reel-actions {
  position: absolute;
  right: 10px;
  bottom: 110px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  z-index: 3;
}

.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
}

.action .action-count {
  font-size: 12px;
  font-weight: 600;
}

.action.active {
  opacity: 1;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.action svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.action.liked svg {
  fill: #ff3b5c;
  stroke: #ff3b5c;
}

.action.saved svg {
  fill: #fff;
  stroke: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.88);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 10;
  max-width: 80%;
  text-align: center;
}

.toast.show {
  opacity: 1;
}

.empty {
  display: flex;
  height: 100vh;
  height: 100dvh;
  align-items: center;
  justify-content: center;
  color: var(--hint);
  padding: 24px;
  text-align: center;
  line-height: 1.5;
}

/* Profil tugmasi (feed ustida, chap yuqorida) */
.icon-btn {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: 12px;
  z-index: 9;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

/* Ekranlar (profil / yuklash) */
.screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--bg);
  color: var(--text);
  overflow-y: auto;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.screen-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--bg);
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

.screen-head h2 {
  font-size: 17px;
  font-weight: 600;
}

.back {
  border: none;
  background: transparent;
  color: var(--btn);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
}

.screen-body {
  padding: 14px;
}

.screen-body h3 {
  font-size: 15px;
  margin: 18px 0 10px;
}

.card {
  background: var(--tg-theme-secondary-bg-color, rgba(128, 128, 128, 0.12));
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.card .card-title {
  font-size: 13px;
  color: var(--hint);
  margin-bottom: 6px;
}

.card .card-main {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
}

.card .card-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 4px;
}

.primary {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 12px;
  background: var(--btn);
  color: var(--btn-text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.primary:disabled {
  opacity: 0.55;
}

.card .primary {
  margin-top: 4px;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field span {
  display: block;
  font-size: 13px;
  color: var(--hint);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(128, 128, 128, 0.3);
  border-radius: 10px;
  background: var(--tg-theme-secondary-bg-color, rgba(128, 128, 128, 0.1));
  color: var(--text);
  font-size: 15px;
}

.hint {
  font-size: 12px;
  color: var(--hint);
  margin-top: 12px;
  text-align: center;
  line-height: 1.5;
}

.list .row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
  font-size: 14px;
}

.list .row .row-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list .row .row-stats {
  color: var(--hint);
  font-size: 12px;
  white-space: nowrap;
}

.list-empty {
  color: var(--hint);
  font-size: 14px;
  padding: 10px 0;
}
