:root {
  --bg: #ffffff;
  --bg-soft: #ffffff;
  --card-bg: #ffffff;
  --text: #1a1d25;
  --muted: #606779;
  --primary: #c8102e;
  --primary-strong: #8f0018;
  --primary-soft: #ffe8ed;
  --border: #e3e5ea;
  --shadow: 0 8px 24px rgba(34, 28, 30, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #fff;
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  border-bottom: 0;
  padding: 12px 16px 14px;
  box-shadow: 0 8px 20px rgba(143, 0, 24, 0.28);
}

.app-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px;
}

.balance-pill {
  margin-top: 8px;
  display: inline-block;
  font-size: 13px;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.26);
  backdrop-filter: blur(4px);
  border-radius: 999px;
  padding: 5px 11px;
}

.screen-root {
  flex: 1;
  padding: 10px 10px 14px;
}

.screen h1 {
  margin: 4px 0 10px;
  font-size: 20px;
  letter-spacing: 0.2px;
}

.plaza-controls {
  margin-bottom: 8px;
  border: 1px solid #ead5da;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff 0%, #fff7f9 100%);
  box-shadow: 0 6px 16px rgba(37, 24, 28, 0.06);
  padding: 10px;
}

.deadline-badge {
  margin: 0 0 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #e7b3bf;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.filter-row {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.filter-row.compact {
  margin-bottom: 0;
}

.filter-row label {
  font-size: 12px;
  color: #525a6b;
  font-weight: 700;
}

.filter-row select,
.form select,
.form textarea,
.form input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 14px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-row select:focus,
.form select:focus,
.form textarea:focus,
.form input:focus {
  outline: 0;
  border-color: #d04760;
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.12);
}

.hidden-file-input {
  display: none;
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 10px 11px;
}

.file-btn {
  border: 1px solid #d4687c;
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--primary-strong);
  font-weight: 600;
}

.file-status {
  font-size: 14px;
  color: var(--muted);
}

.card-list {
  display: grid;
  gap: 8px;
}

.counts-row {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
  background: #fff;
  border: 1px dashed #ddc4cb;
  border-radius: 10px;
  padding: 8px 10px;
}

.plaza-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 520px) {
  .control-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:active {
  transform: translateY(1px);
  box-shadow: 0 5px 16px rgba(34, 28, 30, 0.11);
}

.card img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.card p {
  margin: 6px 0;
  font-size: 14px;
  line-height: 1.35;
}

.media-shell {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: #fff;
}

.image-track {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  height: 100%;
}

.image-track img {
  flex: 0 0 100%;
  height: 100%;
  object-fit: cover;
  scroll-snap-align: start;
  border: 0;
  border-radius: 0;
}

.previewable-image {
  cursor: zoom-in;
}

.image-track-dots {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(17, 20, 26, 0.28);
}

.track-dot {
  width: 8px;
  height: 8px;
  border: 0;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
}

.track-dot.is-active {
  background: #fff;
  transform: scale(1.1);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-meta {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.votes-count {
  font-size: 13px;
  color: var(--muted);
}

.primary-btn,
.vote-btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 14px rgba(143, 0, 24, 0.25);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.primary-btn:active,
.vote-btn:active {
  transform: translateY(1px) scale(0.99);
  filter: brightness(0.98);
  box-shadow: 0 4px 10px rgba(143, 0, 24, 0.2);
}

.form {
  display: grid;
  gap: 12px;
}

.form label {
  display: grid;
  gap: 6px;
}

.preview-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.preview-card {
  position: relative;
}

.preview-item {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(35, 36, 42, 0.08);
}

.preview-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  border: 0;
  border-radius: 999px;
  background: rgba(143, 0, 24, 0.88);
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
}

.muted {
  font-size: 13px;
  color: var(--muted);
}

.error-text {
  margin: -2px 0 0;
  font-size: 13px;
  color: #c62424;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.bottom-nav {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid #e6c0c8;
  background: #fff;
  box-shadow: 0 -6px 18px rgba(34, 28, 30, 0.08);
}

.tab-btn {
  border: 0;
  background: transparent;
  padding: 13px 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.tab-btn.is-active {
  color: var(--primary);
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(35, 22, 26, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: 0 18px 40px rgba(24, 20, 22, 0.28);
}

.modal-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.modal-message {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  white-space: pre-line;
}

.modal-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-btn {
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
}

.modal-btn.ghost {
  border: 1px solid #c7cedd;
  background: #fff;
}

.modal-btn.primary {
  border: 0;
  background: var(--primary);
  color: #fff;
}

.image-viewer-card {
  width: min(560px, 100%);
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 12px;
  position: relative;
  box-shadow: 0 20px 45px rgba(24, 20, 22, 0.32);
}

.image-viewer-close {
  position: absolute;
  right: 10px;
  top: 8px;
  border: 0;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  color: #4f5870;
}

.image-viewer-img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f6f8fc;
}

.image-viewer-toolbar {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
