:root {
  --bg: #0f1115;
  --panel: #171a21;
  --text: #f5f7fb;
  --muted: #8e95a5;
  --blue: #2f80ff;
  --green: #27c179;
  --danger: #ff5959;
  --app-height: 100vh;
  --bottom-nav-height: 74px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

body {
  min-height: var(--app-height);
}

.app-shell {
  max-width: 480px;
  min-height: var(--app-height);
  margin: 0 auto;
  padding: env(safe-area-inset-top) 12px calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 6px 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, #151b26 0%, #111720 100%);
  border: 1px solid #242c3b;
}

.topbar-copy {
  min-width: 0;
}

h1 {
  margin: 2px 0 4px;
  font-size: 34px;
  line-height: 1;
}

h2 {
  margin: 0 0 12px;
}

.eyebrow {
  margin: 0 0 2px;
  color: #e8eefc;
  font-size: 16px;
  font-weight: 700;
}

.status-chip {
  display: inline-block;
  margin: 0;
  padding: 0;
  border-radius: 0;
  font-size: 12px;
  font-weight: 500;
  color: #aeb7c9;
  background: transparent;
}

.btn-ghost,
.btn-primary {
  border: 0;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn-ghost {
  align-self: center;
  white-space: nowrap;
  background: #1d2b42;
  color: #d9e8ff;
  border: 1px solid #314866;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 12px;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  padding: 12px 16px;
}


.screen {
  display: none;
}

.screen.active {
  display: block;
}

.video-feed {
  display: grid;
  gap: 14px;
}

.feed-search {
  display: grid;
  grid-template-columns: 42% 1fr;
  gap: 8px;
  margin: 0 0 10px;
  position: relative;
  align-items: start;
}

.feed-search-city,
.feed-search-input {
  width: 100%;
  border: 1px solid #2b3142;
  border-radius: 12px;
  padding: 10px 12px;
  background: #171d28;
  color: #e8ecf5;
  font: inherit;
}

.feed-search-city {
  appearance: none;
}

.feed-search-input::placeholder {
  color: #93a0b9;
}

.city-suggest {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  margin-top: -2px;
  padding-bottom: 2px;
}

.city-suggest:empty {
  display: none;
}

#feedCitySuggest {
  position: absolute;
  left: 0;
  top: calc(100% - 2px);
  width: 42%;
  z-index: 30;
  grid-column: auto;
  margin-top: 0;
  padding: 6px;
  border: 1px solid #2b3142;
  border-radius: 10px;
  background: #111722;
}

.city-chip {
  flex: 0 0 auto;
  border: 1px solid #2d3850;
  background: #161d2a;
  color: #cfd8ea;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.video-card {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  background: #191c24;
  min-height: 72vh;
}

.video-card video {
  width: 100%;
  height: 72vh;
  object-fit: cover;
}

.video-sound-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 19px;
  cursor: pointer;
}

.gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.66), rgba(0, 0, 0, 0.08) 45%, transparent 72%);
  pointer-events: none;
}

.meta {
  position: absolute;
  left: 14px;
  right: 72px;
  bottom: 12px;
  z-index: 2;
}

.meta h3 {
  margin: 8px 0 8px;
  font-size: 25px;
}

.price {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.city {
  margin: 4px 0 0;
  color: #dbe4ff;
}

.seller-contact-btn {
  position: relative;
  z-index: 4;
  margin-top: 10px;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  background: #2f80ff;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  touch-action: manipulation;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
}

.badge-verified {
  background: rgba(39, 193, 121, 0.22);
  color: #78f0b5;
}

.badge-pending {
  background: rgba(255, 184, 71, 0.22);
  color: #ffd98f;
}

.badge-urgent {
  background: rgba(255, 89, 89, 0.22);
  color: #ffb8b8;
}

.actions {
  position: absolute;
  right: 10px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2;
}

.icon-btn {
  position: relative;
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.17);
  backdrop-filter: blur(2px);
  font-weight: 700;
  touch-action: manipulation;
}

.panel {
  background: var(--panel);
  border: 1px solid #262d3c;
  border-radius: 18px;
  padding: 16px;
}

.steps {
  margin: 0 0 12px;
  color: #d2d7e5;
  padding-left: 20px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 11px;
  min-width: 0;
}

.field span {
  color: #d2d7e5;
  font-size: 13px;
}

input,
textarea {
  background: #11141b;
  color: var(--text);
  border: 1px solid #303849;
  border-radius: 12px;
  padding: 10px;
  font: inherit;
  max-width: 100%;
  min-width: 0;
}

/* WebView / мобильные: нативный выбор файла часто шире экрана */
input[type="file"] {
  width: 100%;
  padding: 8px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  margin-right: 10px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: #2f3f5c;
  color: #e8ecf5;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

#createScreen .panel {
  overflow-x: hidden;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  min-height: 20px;
}

.hint-muted {
  font-size: 12px;
  line-height: 1.45;
  margin-top: 8px;
  color: var(--muted);
}

.my-listings-panel h2 {
  margin-bottom: 4px;
}

.my-listings-root {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.my-listing-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 16px;
  background: linear-gradient(180deg, #151d2a 0%, #121a26 100%);
  border: 1px solid #243245;
}

.my-listing-open {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 2px;
  border-radius: 10px;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.my-listing-open:active {
  background: #20293a;
}

.my-listing-delete {
  border: 1px solid #5d2d2d;
  background: #2a1a1a;
  color: #ffb3b3;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.my-listing-body {
  min-width: 0;
}

.my-listing-title {
  font-weight: 700;
  font-size: 14px;
  margin: 0 0 3px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.my-listing-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.my-listing-status {
  font-size: 11px;
  margin-top: 3px;
  font-weight: 600;
  color: #7dd3a8;
  white-space: normal;
  overflow: visible;
  line-height: 1.35;
}

.my-listing-status-line1 {
  display: block;
}

.my-listing-status-line2 {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 600;
  opacity: 0.92;
}

.my-listing-status.expired {
  color: var(--muted);
  font-weight: 500;
}

.my-listing-status.pending {
  color: #e6c84a;
  font-weight: 600;
}

.my-listing-status.verified {
  color: #7dd3a8;
  font-weight: 600;
}

.my-listing-status.rejected {
  color: #ff9e8a;
  font-weight: 600;
}

.my-listing-status-line3 {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 500;
  opacity: 0.88;
}

.empty-my {
  text-align: center;
  padding: 16px 12px;
}

.empty-my .btn-primary {
  margin-top: 12px;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-height: calc(var(--app-height) - 220px);
  max-height: calc(var(--app-height) - 220px);
  overflow: hidden;
}

.chat-caption {
  margin: 0;
  color: #d2d7e5;
  overflow-wrap: anywhere;
}

.chat-log {
  background: #11141b;
  border: 1px solid #303849;
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 9px;
  min-height: 0;
  max-height: none;
  flex: 1;
  overflow: auto;
}

.msg {
  max-width: 85%;
  border-radius: 12px;
  padding: 9px 11px;
  font-size: 14px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.msg.buyer {
  justify-self: start;
  background: #24304a;
}

.msg.seller {
  justify-self: end;
  background: #1f4735;
}

.chat-compose {
  display: flex;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: var(--panel);
  padding-top: 8px;
  z-index: 3;
}

.chat-compose input {
  flex: 1;
  min-width: 0;
}

.chat-compose .btn-primary {
  flex-shrink: 0;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(480px, 100%);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(15, 17, 21, 0.95);
  backdrop-filter: blur(8px);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  z-index: 100;
}

.nav-btn {
  border: 1px solid #2b3142;
  color: #ccd3e2;
  background: #191e28;
  border-radius: 12px;
  padding: 10px 6px;
  font-weight: 600;
  font-size: 13px;
}

.nav-btn.active {
  color: #fff;
  border-color: #4f8cff;
  background: #1f3f74;
}
