/* AI Pict Pass Neon Party Design System */
:root {
  --bg-dark: #07050f;
  --bg-card: rgba(20, 16, 38, 0.7);
  --border-color: rgba(255, 255, 255, 0.09);
  --text-light: #f5f3fa;
  --text-muted: #9f99bc;
  
  /* Neon Palette */
  --neon-purple: #bd5eff;
  --neon-blue: #00d2ff;
  --neon-pink: #ff3377;
  --neon-orange: #ff9100;
  --neon-green: #39ff14;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-dark);
  color: var(--text-light);
  font-family: 'Outfit', 'M PLUS Rounded 1c', sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
  padding: 20px;
}

/* Background animated bubbles */
.bg-decor-bubble {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: 1;
  pointer-events: none;
  opacity: 0.25;
}
.bubble-1 {
  width: 400px;
  height: 400px;
  background: var(--neon-purple);
  top: -100px;
  left: -100px;
  animation: floatBG 15s infinite alternate;
}
.bubble-2 {
  width: 500px;
  height: 500px;
  background: var(--neon-blue);
  bottom: -150px;
  right: -100px;
  animation: floatBG 20s infinite alternate-reverse;
}

@keyframes floatBG {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.1); }
}

/* Main Container card */
.game-container {
  width: 100%;
  max-width: 840px;
  min-height: 600px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 32px;
  padding: 40px;
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  box-shadow: 
    0 24px 64px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  z-index: 2;
  display: flex;
  flex-direction: column;
}

/* Screen Transitions */
.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  animation: fadeIn 0.4s ease-out;
}
.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Headers & Badges */
.brand-badge {
  background: rgba(189, 94, 255, 0.15);
  border: 1.5px solid var(--neon-purple);
  color: var(--neon-purple);
  font-weight: 900;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  padding: 6px 14px;
  border-radius: 50px;
  margin-bottom: 20px;
  text-shadow: 0 0 10px rgba(189, 94, 255, 0.3);
}
.brand-badge.success {
  background: rgba(57, 255, 20, 0.15);
  border-color: var(--neon-green);
  color: var(--neon-green);
}

.main-title {
  font-size: 3rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff 30%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.main-subtitle {
  color: var(--text-muted);
  font-size: 1.15rem;
  text-align: center;
  line-height: 1.6;
  margin-bottom: 30px;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--neon-purple), #8e24aa);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 16px 36px;
  font-size: 1.2rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(189, 94, 255, 0.35);
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 10px;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(189, 94, 255, 0.5);
}
.btn-primary:disabled {
  background: #3a364d;
  color: #726d8a;
  box-shadow: none;
  cursor: not-allowed;
}
.btn-primary.btn-yellow {
  background: linear-gradient(135deg, var(--neon-orange), #f57c00);
  box-shadow: 0 8px 24px rgba(255, 145, 0, 0.35);
}

.btn-secondary {
  background: rgba(0, 210, 255, 0.05);
  border: 1px dashed var(--neon-blue);
  color: var(--neon-blue);
  border-radius: 14px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 210, 255, 0.1);
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-secondary:hover {
  background: rgba(0, 210, 255, 0.12);
  border-style: solid;
  box-shadow: 0 8px 24px rgba(0, 210, 255, 0.25);
  transform: translateY(-2px);
}
.btn-secondary:active {
  transform: translateY(0);
}

.btn-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-light);
  padding: 12px 28px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.btn-action:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Settings Card */
.settings-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid var(--border-color);
  border-radius: 24px;
  padding: 24px;
  margin-bottom: 30px;
}
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.setting-item label {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}
.number-selector {
  display: flex;
  align-items: center;
  gap: 16px;
}
.btn-num-adjust {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: white;
  font-size: 1.3rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-num-adjust:hover {
  background: rgba(255, 255, 255, 0.12);
}
.num-display {
  font-size: 1.6rem;
  font-weight: 900;
  min-width: 20px;
  text-align: center;
}

/* Model Loading Status */
.model-status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 30px;
}
.pulse-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 10px var(--neon-green);
}
.pulse-indicator.loading {
  background: var(--neon-orange);
  box-shadow: 0 0 10px var(--neon-orange);
  animation: pulseBeat 1.2s infinite alternate;
}

@keyframes pulseBeat {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

/* Ready Screen Layout */
.turn-badge {
  background: rgba(255, 145, 0, 0.15);
  border: 1.5px solid var(--neon-orange);
  color: var(--neon-orange);
  font-weight: 900;
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 0.9rem;
  margin-bottom: 24px;
}
.ready-title {
  font-size: 2.2rem;
  font-weight: 900;
  margin-bottom: 30px;
  text-align: center;
}
.ready-word-box {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--neon-orange);
  box-shadow: 0 0 20px rgba(255, 145, 0, 0.15);
  border-radius: 24px;
  padding: 30px 60px;
  text-align: center;
  margin-bottom: 30px;
  animation: popScale 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popScale {
  from { transform: scale(0.9); }
  to { transform: scale(1); }
}

.word-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.secret-word-text {
  font-size: 3rem;
  font-weight: 900;
  color: var(--text-light);
}
.word-reading-text {
  font-size: 1.1rem;
  color: var(--neon-orange);
  margin-top: 4px;
}

/* Game Header */
.game-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1.5px solid var(--border-color);
  padding-bottom: 16px;
}
.secret-word-indicator {
  font-weight: 900;
  font-size: 1.3rem;
  color: var(--neon-purple);
}

/* Drawing Screen Layout */
.drawing-layout {
  display: flex;
  gap: 30px;
  width: 100%;
  margin-bottom: 30px;
}

.canvas-wrapper {
  position: relative;
  width: 400px;
  height: 400px;
  background: white;
  border: 5px solid #1a172c;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(0,0,0,0.3);
}

#drawCanvas {
  touch-action: none;
}
#drawCanvas, #previewCanvas, #drawModelCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.canvas-controls {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 10;
}
.btn-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: var(--neon-pink);
  color: white;
  box-shadow: 0 4px 12px rgba(255, 51, 119, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}
.btn-circle:hover {
  transform: scale(1.1);
}

/* AI Prediction Panels */
.ai-hint-panel {
  flex-grow: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.ai-predictions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
}
.prediction-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
}
.prediction-item.placeholder {
  color: var(--text-muted);
  border-style: dashed;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}
.prediction-label {
  font-size: 1.15rem;
}
.prediction-pct {
  color: var(--neon-blue);
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
}

/* Pass / Transitions */
.pass-icon-wrapper {
  font-size: 5rem;
  color: var(--neon-purple);
  margin-bottom: 24px;
  animation: floatyIcon 2s infinite ease-in-out;
}

@keyframes floatyIcon {
  0% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0); }
}

/* Guess Screen Inputs */
.guess-input-box {
  width: 100%;
  display: flex;
  gap: 16px;
}
.guess-input-box input {
  flex-grow: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--border-color);
  border-radius: 20px;
  padding: 16px 24px;
  color: white;
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  outline: none;
  transition: border-color 0.2s;
}
.guess-input-box input:focus {
  border-color: var(--neon-purple);
  box-shadow: 0 0 12px rgba(189, 94, 255, 0.25);
}

/* Summary / Chain Timeline */
.chain-timeline {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin-bottom: 40px;
}
.timeline-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid var(--border-color);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 30px;
}
.timeline-step-badge {
  font-weight: 900;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  color: var(--neon-orange);
  background: rgba(255, 145, 0, 0.12);
  border: 1px solid var(--neon-orange);
  border-radius: 8px;
  padding: 6px 12px;
  white-space: nowrap;
}
.timeline-canvas-preview {
  width: 140px;
  height: 140px;
  border-radius: 16px;
  border: 3px solid #1a172c;
  background: white;
  object-fit: contain;
}
.timeline-details {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.timeline-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.timeline-title-row h4 {
  font-size: 1.4rem;
  font-weight: 900;
}
.timeline-title-row span {
  color: var(--text-muted);
  font-size: 0.95rem;
}
.timeline-details .guess-outcome {
  font-size: 1.15rem;
  font-weight: 700;
}
.guess-outcome.correct {
  color: var(--neon-green);
}
.guess-outcome.incorrect {
  color: var(--neon-pink);
}

#drawModelWrapper {
  border-color: var(--neon-purple);
  box-shadow: 0 8px 24px rgba(189, 94, 255, 0.2);
  opacity: 0.85;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .drawing-layout {
    flex-direction: column;
    align-items: center;
  }
  .canvas-wrapper {
    width: 320px;
    height: 320px;
  }
  .ai-hint-panel {
    width: 100%;
  }
  .timeline-card {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 16px;
  }
  .timeline-title-row {
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }
  .timeline-canvas-preview {
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px 5px;
    align-items: flex-start; /* Prevent screen jumping when keyboard opens */
  }
  .game-container {
    padding: 20px 12px;
    border-radius: 16px;
  }
  .canvas-wrapper {
    width: 290px;
    height: 290px;
  }
}

/* Modal Styling */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 3, 10, 0.8);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  transition: all 0.3s ease;
}
.modal.hidden {
  display: none !important;
}
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(189, 94, 255, 0.2);
  border-radius: 28px;
  width: 90%;
  max-width: 460px;
  padding: 30px;
  position: relative;
  animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes modalScaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}
.modal-header h3 {
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 1.3rem;
  color: var(--text-light);
}
.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}
.btn-close:hover {
  color: var(--neon-pink);
}
.modal-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.4;
}
.form-group {
  margin-bottom: 16px;
  text-align: left;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--neon-blue);
  margin-bottom: 6px;
  font-weight: 700;
}
.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-light);
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
}
.form-group input:focus {
  border-color: var(--neon-purple);
  box-shadow: 0 0 10px rgba(189, 94, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

