/* ad-chrome.css — Shared styles for all ad iframes
   Loaded by every ad HTML file */

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

:root {
  --ad-bg:      #585e69;
  --ad-accent:  #235297;
  --ad-text:    #ffffff;
  --ad-dim:     rgba(75, 64, 190, 0.559);
  --ad-border:  2px solid #6c778c;
  --ad-font:    'Courier New', Courier, monospace;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ad-bg);
}

/* ── Main wrapper ─────────────────────────────────────────────────── */
.ad-wrapper {
  position: relative;       /* for close-dialog absolute positioning */
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--ad-bg);
  border: var(--ad-border);
  overflow: hidden;
  font-family: var(--ad-font);
  color: var(--ad-text);
}

/* ── Header bar ───────────────────────────────────────────────────── */
.ad-header {
  flex-shrink: 0;
  height: 22px;
  background: var(--ad-accent);
  color: var(--ad-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 0.5px;
  user-select: none;
}

.ad-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Close button (the ×) ─────────────────────────────────────────── */
#close-btn {
  flex-shrink: 0;
  background: var(--ad-bg);
  color: var(--ad-accent);
  border: 1px solid var(--ad-bg);
  font-family: var(--ad-font);
  font-size: 11px;
  font-weight: bold;
  width: 16px;
  height: 16px;
  line-height: 14px;
  text-align: center;
  cursor: pointer;
  padding: 0;
}
#close-btn:hover { background: #1a1a2e; }

/* ── Canvas area ─────────────────────────────────────────────────── */
.ad-canvas-area {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.ad-canvas-area canvas {
  display: block;
  image-rendering: pixelated;
  cursor: crosshair;
}

/* ── Score bar ────────────────────────────────────────────────────── */
.ad-score-bar {
  flex-shrink: 0;
  height: 18px;
  background: #111122;
  border-top: 1px solid var(--ad-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--ad-accent);
  letter-spacing: 1px;
}

/* ── Nav reveal link (hidden until player wins) ──────────────────── */
#nav-reveal {
  display: none;
  flex-shrink: 0;
  height: 28px;
  background: #ffff00;
  color: #000000;
  text-decoration: none;
  font-family: var(--ad-font);
  font-size: 8px;
  font-weight: bold;
  text-align: center;
  line-height: 28px;
  letter-spacing: 0.5px;
  border-top: 2px solid #ff6600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
  cursor: pointer;
}

/* Flash animation on win */
@keyframes navFlash {
  0%, 100% { background: #ffff00; color: #000; }
  50%       { background: #ff6600; color: #fff; }
}
#nav-reveal.nav-flash { animation: navFlash 0.6s ease-in-out infinite; }

/* ── Close confirmation dialog ───────────────────────────────────── */
#close-dialog {
  display: none;             /* shown by engine.closeDialog.show() */
  position: absolute;
  z-index: 999;
  top: 28px;
  left: 10px;
  width: 136px;
  flex-direction: column;
  gap: 6px;
  padding: 10px 10px 8px;
  background: #0d0d22;
  border: 2px solid var(--ad-accent);
  box-shadow: 0 0 16px rgba(255,102,0,0.5);
  font-size: 9px;
  color: var(--ad-text);
  transition: top 0.12s ease, left 0.12s ease;
}

#close-dialog p {
  font-size: 9px;
  line-height: 1.4;
  color: #dddddd;
  margin-bottom: 2px;
}

.dialog-buttons {
  display: flex;
  gap: 6px;
}

.dialog-buttons button {
  flex: 1;
  padding: 4px 2px;
  font-family: var(--ad-font);
  font-size: 8px;
  font-weight: bold;
  cursor: pointer;
  border: 1px solid var(--ad-accent);
  letter-spacing: 0.3px;
}

#close-yes {
  background: #1a0000;
  color: #ff4444;
}
#close-yes:hover { background: #2d0000; }

#close-no {
  background: #001a00;
  color: #44ff44;
}
#close-no:hover { background: #002d00; }

/* ── Name entry overlay ──────────────────────────────────────────── */
#name-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 998;
  background: rgba(10, 10, 26, 0.92);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 9px;
  color: var(--ad-text);
  text-align: center;
  padding: 12px;
}

#name-overlay p {
  font-size: 10px;
  color: var(--ad-accent);
  font-weight: bold;
  letter-spacing: 0.5px;
}

#player-name-input {
  width: 110px;
  padding: 5px 6px;
  background: #111122;
  border: 1px solid var(--ad-accent);
  color: #fff;
  font-family: var(--ad-font);
  font-size: 11px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
  outline: none;
}

#name-submit-btn {
  padding: 5px 16px;
  background: var(--ad-accent);
  color: var(--ad-bg);
  border: none;
  font-family: var(--ad-font);
  font-size: 9px;
  font-weight: bold;
  cursor: pointer;
  letter-spacing: 1px;
}
#name-submit-btn:hover { background: #ff8833; }
