/* Flash Player — Macromedia-red accent on dark charcoal. Identity is
 * deliberate Flash-era chrome, not generic purple glass. */

:root {
  --flash-bg: #141414;
  --flash-panel: #1c1c1c;
  --flash-border: #2e2e2e;
  --flash-text: #f2f2f2;
  --flash-muted: #9a9a9a;
  --flash-accent: #e31c25;
  --flash-accent-soft: rgba(227, 28, 37, 0.14);
  --flash-accent-deep: #9f1218;
  --flash-surface: #262626;
  --flash-scrim: rgba(0, 0, 0, 0.72);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: radial-gradient(
      ellipse 80% 50% at 50% -10%,
      var(--flash-accent-soft),
      transparent 55%
    ),
    var(--flash-bg);
  color: var(--flash-text);
  font-family: Inter, system-ui, sans-serif;
}

.hidden-input,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px 12px 120px;
  background: var(--flash-panel);
  border-bottom: 1px solid var(--flash-border);
}

.app-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.app-sub {
  font-size: 0.82rem;
  color: var(--flash-muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(42vw, 360px);
}

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 1px solid var(--flash-border);
  background: var(--flash-surface);
  color: var(--flash-text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.btn:hover:not(:disabled) {
  border-color: var(--flash-accent);
  background: var(--flash-accent-soft);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
}

.btn-primary,
.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  font-size: 0.95rem;
  font-weight: 700;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--flash-accent-deep);
  border-color: var(--flash-accent-deep);
  filter: none;
}

.btn-secondary {
  background: var(--flash-surface);
  color: var(--flash-text);
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px;
}

/* Class rules set display:flex; without this, [hidden] is ignored. */
.modal[hidden],
.player-wrap[hidden] {
  display: none !important;
}

.brand {
  text-align: center;
  margin-bottom: 4px;
}

.brand-logo {
  display: block;
  font-size: 2.6rem;
  line-height: 1;
  margin-bottom: 8px;
}

.brand-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-sub {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--flash-muted);
}

.boot-card {
  width: 100%;
  padding: 4px 4px 0;
}

.boot-heading {
  margin: 0 0 16px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--flash-muted);
}

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

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--flash-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--flash-border);
}

.hint {
  margin: 16px 0 0;
  text-align: center;
  color: var(--flash-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.hint a {
  color: #ff8a90;
}

.hint code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.92em;
  color: #ffb4b8;
}

.player-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border: 1px solid var(--flash-border);
  border-radius: 12px;
  overflow: hidden;
}

.player-wrap ruffle-player,
.player-wrap .ruffle-embed {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--flash-scrim);
}

.modal-panel {
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  max-height: min(84dvh, 820px);
  background: var(--flash-panel);
  border: 1px solid var(--flash-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-panel-compact {
  width: min(440px, 100%);
  max-height: none;
  gap: 16px;
  padding: 28px 24px 24px;
  overflow: visible;
}

.modal-header {
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--flash-border);
}

.modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-subtitle {
  margin: 4px 0 0;
  color: var(--flash-muted);
  font-size: 0.82rem;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  padding: 14px 20px;
}

.search-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--flash-border);
  border-radius: 8px;
  background: #121212;
  color: var(--flash-text);
  font: inherit;
  font-size: 0.9rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--flash-accent);
  box-shadow: 0 0 0 2px var(--flash-accent-soft);
}

.content-area {
  flex: 1;
  min-height: 240px;
  overflow: auto;
}

.swf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.swf-card {
  padding: 12px;
  border: 1px solid var(--flash-border);
  border-radius: 10px;
  background: #161616;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}

.swf-card:hover,
.swf-card:focus-visible {
  border-color: var(--flash-accent);
  background: var(--flash-accent-soft);
  outline: none;
  transform: translateY(-1px);
}

.swf-title {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 6px;
}

.swf-meta {
  margin: 0;
  color: var(--flash-muted);
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.loading,
.empty,
.error {
  padding: 28px 12px;
  text-align: center;
  color: var(--flash-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.error-detail {
  margin-top: 8px;
  font-size: 0.78rem;
  opacity: 0.85;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--flash-border);
}

.share-overlay {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 200;
}

@media (max-width: 640px) {
  .app-header {
    padding-left: 100px;
  }

  .app-sub {
    display: none;
  }

  .stage {
    padding: 12px;
  }

  .modal-panel-compact {
    padding: 22px 16px 18px;
  }

  .swf-grid {
    grid-template-columns: 1fr;
  }
}
