/* View: VV0RDI_E — Page-specific styles */

/* ─── VV0RDI_E Game Styles ─── */
body {
  background: #0a0a0a;
  color: #e0e0e0;
  font-family: 'Roboto Mono', monospace;
  overflow-x: hidden;
}

.vv-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 16px 16px 32px;
  box-sizing: border-box;
}

/* ─── Header ─── */
.vv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 720px;
  margin-bottom: 16px;
  border-bottom: 1px solid #222;
  padding-bottom: 10px;
}

.vv-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #33ff33;
  text-shadow: 0 0 12px rgba(51, 255, 51, 0.4);
}

.vv-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vv-new-game-btn {
  background: transparent;
  border: 1px solid #33ff33;
  color: #33ff33;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.vv-new-game-btn:hover {
  background: #33ff33;
  color: #0a0a0a;
}

.vv-settings-btn {
  background: transparent;
  border: 1px solid #33ff33;
  color: #33ff33;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.vv-settings-btn:hover {
  background: #33ff33;
  color: #0a0a0a;
}

/* ─── Main two-column layout ─── */
.vv-main {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 24px;
  width: 100%;
  max-width: 720px;
}

.vv-game-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
}

/* ─── Toast ─── */
#vv-toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: #e0e0e0;
  color: #0a0a0a;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 8px 18px;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 1000;
  white-space: nowrap;
}

#vv-toast.show {
  opacity: 1;
}

/* ─── Stats Info Icon & Popover ─── */
.vv-stats-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.vv-info-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.vv-info-icon {
  width: 14px;
  height: 14px;
  border: 1px solid #444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 700;
  color: #555;
  cursor: default;
  line-height: 1;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}

.vv-info-wrap:hover .vv-info-icon {
  border-color: #33ff33;
  color: #33ff33;
}

.vv-info-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 210px;
  background: #111;
  border: 1px solid #33ff33;
  padding: 10px 12px;
  font-size: 0.7rem;
  line-height: 1.5;
  color: #aaa;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 200;
}

/* Arrow pointing down */
.vv-info-popover::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 4px;
  border: 5px solid transparent;
  border-top-color: #33ff33;
}

.vv-info-wrap:hover .vv-info-popover {
  opacity: 1;
  pointer-events: auto;
}

.vv-info-popover a {
  color: #33ff33;
  text-decoration: none;
}

.vv-info-popover a:hover {
  text-decoration: underline;
}

.vv-info-popover p + p {
  margin-top: 6px;
}

/* ─── Stats Panel ─── */
.vv-stats {
  flex: 0 0 180px;
  padding: 12px 14px;
  background: #111;
  border: 1px solid #222;
  box-sizing: border-box;
}

.vv-stats-title {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: #33ff33;
  text-transform: uppercase;
}

.vv-stats-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.vv-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.vv-stat-num {
  font-size: 1.2rem;
  font-weight: 700;
  color: #33ff33;
}

.vv-stat-label {
  font-size: 0.55rem;
  color: #555;
  letter-spacing: 0.04em;
  text-align: center;
}

.vv-graph {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vv-graph-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.6rem;
}

.vv-graph-label {
  width: 12px;
  text-align: right;
  color: #666;
  flex-shrink: 0;
}

.vv-graph-bar-track {
  flex: 1;
  height: 13px;
  background: #1a1a1a;
  position: relative;
}

.vv-graph-bar {
  height: 100%;
  background: #444;
  min-width: 2px;
  transition: width 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 3px;
  box-sizing: border-box;
}

.vv-graph-bar.highlight {
  background: #33ff33;
}

.vv-graph-bar.loss-bar {
  background: #8b1c1c;
}

.vv-graph-count {
  font-size: 0.55rem;
  color: #0a0a0a;
  font-weight: 700;
}

/* ─── Board ─── */
.vv-board {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 5px;
  margin-bottom: 20px;
}

.vv-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.vv-tile {
  width: 62px;
  height: 62px;
  border: 2px solid #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: #e0e0e0;
  background: transparent;
  box-sizing: border-box;
  transition: border-color 0.1s;
  perspective: 250px;
  transform-style: preserve-3d;
  position: relative;
}

.vv-tile[data-letter] {
  border-color: #555;
  animation: vv-pop 0.1s ease;
}

/* Auto-filled locked tile: green border + green text, no pop */
.vv-tile.locked {
  border-color: #33ff33 !important;
  color: #33ff33 !important;
  animation: none !important;
}

.vv-tile[data-state="correct"] {
  background: #33ff33;
  border-color: #33ff33;
  color: #000;
}

.vv-tile[data-state="present"] {
  background: #e622c5;
  border-color: #e622c5;
  color: #fff;
}

.vv-tile[data-state="absent"] {
  background: #3a3a3c;
  border-color: #3a3a3c;
  color: #fff;
}

.vv-tile.reveal-correct {
  animation: vv-flip-correct 0.5s ease forwards;
}

.vv-tile.reveal-present {
  animation: vv-flip-present 0.5s ease forwards;
}

.vv-tile.reveal-absent {
  animation: vv-flip-absent 0.5s ease forwards;
}

.vv-row.shake {
  animation: vv-shake 0.4s ease;
}

@keyframes vv-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes vv-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@keyframes vv-bounce {
  0%, 20% { transform: translateY(0); }
  40% { transform: translateY(-20px); }
  60% { transform: translateY(-10px); }
  80% { transform: translateY(-16px); }
  100% { transform: translateY(0); }
}

@keyframes vv-flip-correct {
  0%   { transform: rotateX(0deg);   background: transparent; border-color: #555; color: #e0e0e0; }
  49%  { transform: rotateX(-90deg); background: transparent; border-color: #555; }
  50%  { transform: rotateX(-90deg); background: #33ff33;     border-color: #33ff33; }
  100% { transform: rotateX(0deg);   background: #33ff33;     border-color: #33ff33; color: #000; }
}

@keyframes vv-flip-present {
  0%   { transform: rotateX(0deg);   background: transparent; border-color: #555; color: #e0e0e0; }
  49%  { transform: rotateX(-90deg); background: transparent; border-color: #555; }
  50%  { transform: rotateX(-90deg); background: #e622c5;     border-color: #e622c5; }
  100% { transform: rotateX(0deg);   background: #e622c5;     border-color: #e622c5; color: #fff; }
}

@keyframes vv-flip-absent {
  0%   { transform: rotateX(0deg);   background: transparent; border-color: #555; color: #e0e0e0; }
  49%  { transform: rotateX(-90deg); background: transparent; border-color: #555; }
  50%  { transform: rotateX(-90deg); background: #3a3a3c;     border-color: #3a3a3c; }
  100% { transform: rotateX(0deg);   background: #3a3a3c;     border-color: #3a3a3c; color: #fff; }
}

/* ─── Keyboard ─── */
.vv-keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  width: 100%;
  max-width: 500px;
}

.vv-key-row {
  display: flex;
  gap: 5px;
  justify-content: center;
}

.vv-key {
  height: 58px;
  min-width: 43px;
  padding: 0 6px;
  background: #818384;
  color: #fff;
  border: none;
  border-radius: 2px;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.vv-key.wide {
  min-width: 65px;
  font-size: 0.7rem;
}

.vv-key.state-correct {
  background: #33ff33 !important;
  color: #000 !important;
}

.vv-key.state-present {
  background: #e622c5 !important;
  color: #fff !important;
}

.vv-key.state-absent {
  background: #1e1e1e !important;
  color: #333 !important;
}

/* Absent-blocking is toggled via JS class on the keyboard element */
#vv-keyboard.block-absent .vv-key.state-absent {
  pointer-events: none !important;
  cursor: default !important;
}

.vv-key:not(.state-absent):active {
  filter: brightness(0.85);
}

/* ─── Settings Modal ─── */
.vv-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.vv-modal {
  background: #111;
  border: 1px solid #33ff33;
  width: 360px;
  max-width: calc(100vw - 32px);
  font-family: 'Roboto Mono', monospace;
}

.vv-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #1e1e1e;
}

.vv-modal-title {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: #33ff33;
  font-weight: 700;
}

.vv-modal-close {
  background: transparent;
  border: none;
  color: #555;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
  font-family: inherit;
}

.vv-modal-close:hover {
  color: #e0e0e0;
}

.vv-modal-body {
  padding: 4px 16px 8px;
  display: flex;
  flex-direction: column;
}

.vv-rule-item {
  padding: 12px 0;
  border-bottom: 1px solid #1a1a1a;
}

.vv-rule-item:last-child {
  border-bottom: none;
}

.vv-rule-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.vv-rule-label span {
  font-size: 0.75rem;
  color: #e0e0e0;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.vv-rule-desc {
  font-size: 0.62rem;
  color: #555;
  line-height: 1.5;
  margin: 5px 0 0 28px;
}

/* Custom checkbox */
.vv-rule-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid #444;
  background: transparent;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}

.vv-rule-label input[type="checkbox"]:checked {
  border-color: #33ff33;
  background: #33ff33;
}

.vv-rule-label input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: 2px solid #000;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* ─── Responsive ─── */
@media (max-width: 680px) {
  .vv-main {
    flex-direction: column;
    align-items: center;
  }
  .vv-game-col {
    width: 100%;
  }
  .vv-stats {
    flex: none;
    width: 100%;
    max-width: 500px;
  }
  .vv-stats-summary {
    grid-template-columns: repeat(4, 1fr);
  }
  /* Tiles: scale fluidly so 5 tiles + 4 gaps always fit the content width */
  .vv-tile {
    width: clamp(44px, calc((100vw - 52px) / 5), 62px);
    height: clamp(44px, calc((100vw - 52px) / 5), 62px);
    font-size: clamp(1.2rem, 6vw, 1.8rem);
  }
  /* Keyboard: fill the game column and let keys flex to fill each row */
  .vv-keyboard {
    width: 100%;
    max-width: none;
  }
  .vv-key-row {
    width: 100%;
  }
  .vv-key {
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0 2px;
  }
  .vv-key.wide {
    flex: 1.5;
    min-width: 0;
  }
}
