:root {
  --bg: #1a1410;
  --surface: #2a2218;
  --text: #f5ebe0;
  --muted: #a89888;
  --accent: #c45c26;
  --danger: #b83232;
  --ok: #4a9e6a;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid #3d3228;
}

.site-header h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.user-badge {
  font-size: 0.85rem;
  color: var(--muted);
}

.link-quiet {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.site-main {
  flex: 1;
  padding: 1rem;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.site-footer {
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.8rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1rem;
}

.login-card {
  margin-top: 2rem;
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
}

.video-wrap.is-fullscreen {
  cursor: default;
}

.gate-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
  pointer-events: none;
}

.video-tap-hint {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
  background: rgba(0, 0, 0, 0.45);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  pointer-events: none;
  z-index: 1;
}

.video-wrap.is-fullscreen .video-tap-hint,
.video-wrap.video-fullscreen-fallback .video-tap-hint {
  display: none;
}

.video-fullscreen-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  padding: 1rem max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  pointer-events: auto;
}

.video-fullscreen-bar[hidden] {
  display: none !important;
}

.video-wrap.is-fullscreen .video-fullscreen-bar,
.video-wrap.video-fullscreen-fallback .video-fullscreen-bar {
  display: flex !important;
}

.btn-get-em-overlay {
  margin: 0;
  font-size: 1.15rem;
  padding: 1rem 1.25rem;
}

.btn-fs-exit {
  align-self: center;
  min-width: 6rem;
}

.video-wrap:fullscreen,
.video-wrap:-webkit-full-screen,
.video-wrap.video-fullscreen-fallback {
  position: fixed;
  inset: 0;
  z-index: 10000;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  aspect-ratio: auto;
  border-radius: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

.video-wrap:fullscreen .gate-video,
.video-wrap:-webkit-full-screen .gate-video,
.video-wrap.video-fullscreen-fallback .gate-video {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.video-wrap:fullscreen .video-fullscreen-bar,
.video-wrap:-webkit-full-screen .video-fullscreen-bar,
.video-wrap.video-fullscreen-fallback .video-fullscreen-bar {
  position: relative;
  flex-shrink: 0;
  left: auto;
  right: auto;
  bottom: auto;
}

@media (orientation: landscape) {
  .video-wrap.is-fullscreen .video-fullscreen-bar,
  .video-wrap.video-fullscreen-fallback .video-fullscreen-bar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: max(0.65rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-right))
      max(0.65rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  }

  .video-wrap.is-fullscreen .btn-get-em-overlay,
  .video-wrap.video-fullscreen-fallback .btn-get-em-overlay {
    flex: 1 1 10rem;
    max-width: 16rem;
    margin: 0;
  }

  .video-wrap.is-fullscreen .gate-msg-overlay,
  .video-wrap.video-fullscreen-fallback .gate-msg-overlay {
    flex: 1 1 100%;
    margin: 0;
    text-align: center;
  }

  .video-wrap.is-fullscreen .btn-fs-exit,
  .video-wrap.video-fullscreen-fallback .btn-fs-exit {
    flex: 0 0 auto;
  }
}

body.video-fs-open {
  overflow: hidden;
  position: fixed;
  inset: 0;
  width: 100%;
}

body.video-fs-open .site-header,
body.video-fs-open .site-footer {
  visibility: hidden;
  pointer-events: none;
}

.station-card.is-video-fullscreen .btn-get-em-inline,
.station-card.is-video-fullscreen .gate-msg-inline,
.station-card.is-video-fullscreen .station-status {
  display: none;
}

.btn-overlay {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  opacity: 0.85;
}

.form-stack label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.form-stack input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #4d4034;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-ghost {
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  width: auto;
  padding: 0.4rem 0.6rem;
}

.status-line {
  font-size: 0.85rem;
  margin: 0.5rem 0 0;
}

.status-line.error {
  color: #e88;
}

.status-line.ok {
  color: var(--ok);
}

.muted,
.hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.error {
  color: #e88;
  margin: 0 0 0.75rem;
}

.gate-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.station-card {
  margin-bottom: 1.5rem;
}

.station-card:first-child {
  margin-top: 0;
}

.station-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.btn-get-em {
  margin-top: 0.75rem;
}

.form-section {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.95rem;
  border-bottom: 1px solid #4d4034;
  padding-bottom: 0.35rem;
}

.form-stack select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #4d4034;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.admin-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-list-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid #4d4034;
}

.admin-actions {
  margin-top: 0.35rem;
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
}

.admin-actions a {
  color: var(--accent);
}

.inline-form {
  display: inline;
}

.link-btn {
  background: none;
  border: none;
  color: #e88;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
  text-decoration: underline;
}

.badge-inactive {
  color: #e88;
  font-size: 0.8rem;
  margin-left: 0.35rem;
}
