/* CyberLearn - Main Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Cyberpunk Theme */
  --cyber-primary: #ff00ff;
  --cyber-secondary: #00ffff;
  --cyber-bg: #050510;
  --cyber-card: rgba(20, 20, 40, 0.8);
  --cyber-text: #ffffff;

  /* Hacker Theme */
  --hacker-primary: #00ff00;
  --hacker-secondary: #ffaa00;
  --hacker-bg: #0a0a0a;
  --hacker-card: #001100;
  --hacker-text: #e0ffe0;
}

body {
  font-family: 'Rajdhani', 'Fira Code', monospace;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Cyberpunk Theme */
.theme-cyberpunk {
  background-color: var(--cyber-bg);
  color: var(--cyber-text);
  background-image: 
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 2px, 3px 100%;
}

.theme-cyberpunk h1, .theme-cyberpunk h2, .theme-cyberpunk h3 {
  font-family: 'Orbitron', sans-serif;
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
}

/* Hacker Theme */
.theme-hacker {
  background-color: var(--hacker-bg);
  color: var(--hacker-text);
  font-family: 'Fira Code', monospace;
}

.theme-hacker h1, .theme-hacker h2, .theme-hacker h3 {
  font-family: 'Share Tech Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--hacker-primary);
  text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

/* Buttons */
.cyber-btn {
  position: relative;
  padding: 12px 32px;
  font-weight: bold;
  text-transform: uppercase;
  background: transparent;
  border: 2px solid var(--cyber-primary);
  color: var(--cyber-primary);
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
  clip-path: polygon(10% 0, 100% 0, 100% 80%, 90% 100%, 0 100%, 0 20%);
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1rem;
  letter-spacing: 2px;
}

.cyber-btn:hover {
  background: var(--cyber-primary);
  color: #000;
  box-shadow: 0 0 25px var(--cyber-primary), inset 0 0 15px rgba(255, 0, 255, 0.3);
  transform: translateY(-2px);
}

.cyber-btn:active {
  transform: translateY(0) scale(0.98);
}

.cyber-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.cyber-btn.is-loading,
.hacker-btn.is-loading {
  pointer-events: none;
  cursor: wait;
}

.cyber-btn.is-loading {
  color: var(--cyber-primary);
  background: transparent;
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
}

.hacker-btn.is-loading {
  color: var(--hacker-primary);
  background: transparent;
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
}

.loading-label {
  letter-spacing: 2px;
  text-transform: uppercase;
}

.loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
  width: 1.6em;
  justify-content: flex-start;
}

.loading-dots span {
  opacity: 0.2;
  animation: dots-pulse 1.2s infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dots-pulse {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

.hacker-btn {
  position: relative;
  padding: 12px 32px;
  border: 2px solid var(--hacker-primary);
  background: transparent;
  color: var(--hacker-primary);
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.9rem;
  letter-spacing: 2px;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.35);
  clip-path: polygon(10% 0, 100% 0, 100% 80%, 90% 100%, 0 100%, 0 20%);
}

.hacker-btn:hover {
  background: var(--hacker-primary);
  color: #000;
  border-color: var(--hacker-primary);
  box-shadow: 0 0 25px var(--hacker-primary), inset 0 0 15px rgba(0, 255, 0, 0.25);
  transform: translateY(-2px);
}

.hacker-btn:active {
  transform: translateY(0) scale(0.98);
}

.hacker-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* Cards */
.cyber-card {
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  padding: 16px;
  background: var(--cyber-card);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.1);
  transition: all 0.3s;
}

.cyber-card.active {
  border-color: var(--cyber-secondary);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.6), inset 0 0 15px rgba(0, 255, 255, 0.2);
}

.hacker-card {
  border: 1px solid rgba(0, 255, 0, 0.2);
  padding: 16px;
  background: rgba(0, 0, 0, 0.3);
  transition: all 0.2s;
}

.hacker-card.active {
  border-color: var(--hacker-primary);
  background: rgba(0, 255, 0, 0.05);
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

/* Glitch Effect */
.glitch-text {
  position: relative;
}
.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.8;
}
.glitch-text::before {
  color: #ff00ff;
  z-index: -1;
  animation: glitch-anim-1 2s infinite linear alternate-reverse;
}
.glitch-text::after {
  color: #00ffff;
  z-index: -2;
  animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

.theme-cyberpunk .setup-header .glitch-text::before {
  color: var(--cyber-primary);
  animation: glitch-anim-1 2.4s infinite linear alternate-reverse;
  opacity: 0.6;
}

.theme-cyberpunk .setup-header .glitch-text::after {
  color: var(--cyber-primary);
  animation: glitch-anim-2 3.4s infinite linear alternate-reverse;
  opacity: 0.5;
}

.theme-hacker .setup-header .glitch-text::before {
  color: var(--hacker-primary);
  animation-duration: 2.4s;
  opacity: 0.6;
}

.theme-hacker .setup-header .glitch-text::after {
  color: var(--hacker-secondary);
  animation-duration: 3.4s;
  opacity: 0.5;
}
.theme-cyberpunk .setup-header .glitch-text {
  color: #ffffff;
}

.theme-hacker .setup-header .glitch-text {
  color: #ffffff;
}

/* Scanlines for Hacker Theme */
.scanlines {
  display: none;
  background: linear-gradient(
    to bottom,
    rgba(0, 255, 0, 0.02),
    rgba(0, 255, 0, 0.02) 50%,
    rgba(0, 0, 0, 0.08) 50%,
    rgba(0, 0, 0, 0.08)
  );
  background-size: 100% 4px;
  position: fixed;
  pointer-events: none;
  inset: 0;
  z-index: 9999;
}

.theme-hacker .scanlines {
  display: block !important;
}

/* Screen Transitions */
.screen {
  display: none;
  opacity: 0;
  transition: opacity 0.7s ease-in-out;
  min-height: 100vh;
}

.screen.active {
  display: flex;
  opacity: 1;
  animation: screenFadeIn 0.7s ease-in-out;
}

@keyframes screenFadeIn {
  from { 
    opacity: 0;
    transform: translateY(20px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

/* Theme Toggle Button */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
}

#theme-btn {
  padding: 10px 14px;
  border: 2px solid;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.2));
  cursor: pointer;
  font-size: 18px;
  border-radius: 6px;
  transition: all 0.3s;
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

#theme-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
}

#theme-btn svg {
  width: 20px;
  height: 20px;
}

.theme-cyberpunk #theme-btn {
  border-color: var(--cyber-primary);
  color: var(--cyber-primary);
  box-shadow: 0 0 15px rgba(255, 0, 255, 0.4);
}

.theme-cyberpunk #theme-btn svg {
  fill: var(--cyber-primary);
}

.theme-hacker #theme-btn {
  border-color: var(--hacker-primary);
  color: var(--hacker-primary);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.2);
}

.theme-hacker #theme-btn svg {
  fill: var(--hacker-primary);
}

#theme-btn:hover {
  transform: scale(1.1);
}

#theme-btn:hover::after {
  transform: translateX(120%);
}

.theme-cyberpunk #theme-btn:hover {
  box-shadow: 0 0 25px var(--cyber-primary);
  background: rgba(255, 0, 255, 0.1);
}

.theme-hacker #theme-btn:hover {
  box-shadow: 0 0 25px var(--hacker-primary);
  background: rgba(0, 255, 0, 0.1);
}

/* Setup Screen */
#setup-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.setup-header {
  text-align: center;
  margin-bottom: 50px;
}

.setup-header h1 {
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: 8px;
  text-transform: uppercase;
  margin: 0;
  color: #ffffff !important;
}

.theme-cyberpunk .setup-header h1 {
  text-shadow: 0 0 12px rgba(255, 0, 255, 0.6), 0 0 24px rgba(255, 0, 255, 0.5);
}

.theme-hacker .setup-header h1 {
  text-shadow: 0 0 14px rgba(0, 255, 0, 0.6);
}

.setup-header p {
  font-size: 1.1rem;
  opacity: 0.8;
  margin-top: 10px;
}

.setup-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 32px;
  max-width: 1024px;
  width: 100%;
  margin-bottom: 40px;
  align-items: start;
  justify-content: center;
}

@media (max-width: 768px) {
  .setup-content {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Right column (characters) aligned like reference */
.setup-content > .form-section:last-child {
  align-items: flex-start;
}

.setup-content > .form-section:last-child > h2 {
  width: 100%;
  text-align: left;
}

.form-section h2 {
  font-size: 1.3rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.theme-hacker .form-section h2 {
  font-size: 1.5rem;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.theme-selector {
  display: flex;
  gap: 10px;
}

.theme-option {
  flex: 1;
  padding: 12px;
  border: 2px solid rgba(255,255,255,0.1);
  background: transparent;
  color: #fff;
  cursor: pointer;
  text-transform: uppercase;
  font-size: 0.85rem;
  font-weight: bold;
  transition: all 0.3s;
  border-radius: 4px;
}

.theme-cyberpunk .theme-option.active {
  border-color: var(--cyber-primary);
  background: rgba(255, 0, 255, 0.2);
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.3);
}

.theme-hacker .theme-option.active {
  border-color: var(--hacker-primary);
  background: rgba(0, 255, 0, 0.1);
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.15);
}

/* Character & Location Grids */
.character-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  justify-content: stretch;
  justify-items: stretch;
  width: 100%;
  max-width: 100%;
  margin: 0;
}

@media (max-width: 768px) {
  .character-grid {
    grid-template-columns: 1fr;
  }
}

.character-card {
  text-align: center;
  padding: 26px 22px;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 0;
  position: relative;
  width: 100%;
  min-height: 230px;
  opacity: 0.6;
}

.character-card:hover {
  transform: translateY(-4px);
  opacity: 1;
}

.character-card.active {
  transform: scale(1.02);
  opacity: 1;
}

.theme-cyberpunk .character-card.active {
  box-shadow: 0 0 0 2px var(--cyber-secondary), 0 0 0 4px black, 0 0 30px rgba(0, 255, 255, 0.7);
}

.theme-hacker .character-card.active {
  box-shadow: 0 0 0 1px var(--hacker-primary), 0 0 0 3px black, 0 0 16px rgba(0, 255, 0, 0.18);
}

.character-icon {
  font-size: 3.8rem;
  margin-bottom: 12px;
}

.character-name {
  font-weight: bold;
  font-size: 1.15rem;
  margin-bottom: 5px;
}

.character-role {
  font-size: 0.85rem;
  text-transform: uppercase;
  opacity: 0.6;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.character-desc {
  font-size: 0.9rem;
  opacity: 0.7;
}

.location-grid {
  display: grid;
  gap: 12px;
}

.location-card {
  padding: 15px;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 0;
  border-left: 4px solid transparent;
  opacity: 0.6;
}

.location-card:hover {
  transform: translateX(4px);
  opacity: 1;
}

.location-card.active {
  opacity: 1;
  transform: scale(1.02);
}

.theme-cyberpunk .location-card.active {
  border-left-color: var(--cyber-primary);
}

.theme-hacker .location-card.active {
  border-left-color: var(--hacker-primary);
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.15);
}

.location-name {
  font-weight: bold;
  font-size: 0.95rem;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.location-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-cyberpunk .location-icon svg {
  stroke: var(--cyber-primary);
}

.theme-hacker .location-icon svg {
  stroke: var(--hacker-primary);
}

/* Section header icons */
.section-icon {
  width: 24px;
  height: 24px;
  vertical-align: middle;
  margin-right: 8px;
}

.theme-cyberpunk .section-icon {
  fill: var(--cyber-primary);
}

.theme-hacker .section-icon {
  fill: var(--hacker-primary);
}

.theme-cyberpunk .location-name {
  font-size: 1.6rem;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.25);
}

.theme-hacker .location-name {
  font-size: 1.25rem;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.location-desc {
  font-size: 0.85rem;
  opacity: 0.7;
}

/* Input Screen */
#input-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.input-screen-card {
  max-width: 900px;
  width: 100%;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  padding: 32px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.theme-cyberpunk .input-screen-card {
  background: rgba(255, 0, 255, 0.02);
  border: 1px solid rgba(0, 255, 255, 0.15);
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.1),
              inset 0 0 30px rgba(0, 255, 255, 0.02);
}

.theme-hacker .input-screen-card {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 255, 0, 0.35);
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.08),
              inset 0 0 20px rgba(0, 255, 0, 0.04);
  position: relative;
}

.theme-hacker .input-screen-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 255, 0, 0.03) 0px,
    rgba(0, 255, 0, 0.03) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 1;
}

.theme-hacker .input-screen-card > * {
  position: relative;
  z-index: 2;
}
.input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 42px;
  padding: 0 0 18px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-cyberpunk .input-header {
  border-bottom-color: rgba(0, 255, 255, 0.2);
}

.theme-hacker .input-header {
  border-bottom-color: rgba(0, 255, 0, 0.3);
}

#input-title {
  font-size: 1.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin: 0;
  position: relative;
  line-height: 1;
}

.theme-cyberpunk #input-title {
  font-family: 'Orbitron', sans-serif;
  text-shadow: 0 0 10px var(--cyber-primary),
               0 0 20px var(--cyber-secondary);
  animation: none;
}

.theme-cyberpunk #input-title::before,
.theme-cyberpunk #input-title::after {
  display: none;
}

@keyframes glitch {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(2px, -2px); }
}

@keyframes glitch-anim-1 {
  0%, 100% { clip-path: inset(0 0 0 0); }
  20% { clip-path: inset(10% 0 85% 0); }
  40% { clip-path: inset(20% 0 60% 0); }
  60% { clip-path: inset(50% 0 30% 0); }
  80% { clip-path: inset(80% 0 10% 0); }
}

@keyframes glitch-anim-2 {
  0%, 100% { clip-path: inset(0 0 0 0); }
  20% { clip-path: inset(80% 0 10% 0); }
  40% { clip-path: inset(50% 0 30% 0); }
  60% { clip-path: inset(20% 0 60% 0); }
  80% { clip-path: inset(10% 0 85% 0); }
}

.theme-hacker #input-title {
  font-family: 'Share Tech Mono', monospace;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(0, 255, 0, 0.3);
  letter-spacing: 4px;
  font-size: 1.8rem;
  animation: none;
  font-weight: 700;
}

@keyframes pulse-glow {
  0%, 100% {
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5),
                 0 0 20px rgba(0, 255, 0, 0.2);
  }
  50% {
    text-shadow: 0 0 15px rgba(0, 255, 0, 0.8),
                 0 0 30px rgba(0, 255, 0, 0.4);
  }
}

.input-status {
  font-size: 0.8rem;
  font-family: 'Share Tech Mono', monospace;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  line-height: 1;
}

.theme-cyberpunk .input-status {
  color: rgba(0, 255, 255, 0.6);
}

.theme-hacker .input-status {
  color: #ffffff;
  font-size: 0.8rem;
}

/* Text Area */
.input-textarea {
  flex: 1;
  width: 100%;
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: 'Share Tech Mono', 'Fira Code', monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: none;
  outline: none;
  margin: 0 0 24px 0;
  transition: all 0.3s ease;
}

.theme-cyberpunk .input-textarea {
  color: var(--cyber-secondary);
  background: rgba(0, 255, 255, 0.05);
  border: 1px solid rgba(0, 255, 255, 0.2);
  box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.02),
              0 0 15px rgba(0, 255, 255, 0.05);
  font-size: 1.25rem;
}

.theme-cyberpunk .input-textarea::placeholder {
  color: rgba(0, 255, 255, 0.2);
  font-size: 1.25rem;
}

.theme-cyberpunk .input-textarea:focus {
  border-color: rgba(0, 255, 255, 0.6);
  box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.05),
              0 0 20px rgba(0, 255, 255, 0.2);
}

.theme-hacker .input-textarea {
  color: var(--hacker-primary);
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 15px 0 0 0;
  font-size: 1.1rem;
  line-height: 1.8;
}

.theme-hacker .input-textarea::placeholder {
  color: rgba(0, 255, 0, 0.22);
}

.theme-hacker .input-textarea:focus {
  border-color: transparent;
  box-shadow: none;
}

/* Footer */
.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0;
  position: relative;
}

.theme-cyberpunk .input-footer {
  border-top-color: transparent;
}

.theme-hacker .input-footer {
  flex-direction: row;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding-top: 0;
}

.input-char-count {
  font-size: 0.85rem;
  font-family: 'Share Tech Mono', monospace;
  color: rgba(255, 255, 255, 0.4);
  transition: all 0.3s ease;
  line-height: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: 28px;
  padding: 5px 0 0 0;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-cyberpunk .input-char-count {
  color: rgba(0, 255, 255, 0.4);
  border-bottom-color: rgba(0, 255, 255, 0.2);
}

.theme-hacker .input-char-count {
  color: rgba(0, 255, 0, 0.4);
  font-size: 0.95rem;
  text-align: right;
  border-bottom-color: rgba(0, 255, 0, 0.2);
}

.input-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  width: 100%;
  padding-top: 12px;
}

.theme-hacker .input-buttons {
  gap: 30px;
}

/* Actions */
.input-actions {
  display: flex;
  gap: 20px;
  align-items: center;
}

.input-abort {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s;
  font-family: 'Share Tech Mono', monospace;
  font-weight: 400;
  padding: 0;
}

.theme-cyberpunk .input-abort {
  color: rgba(255, 0, 255, 0.6);
  font-size: 1.1rem;
}

.theme-cyberpunk .input-abort:hover {
  color: var(--cyber-primary);
  transform: translateX(-2px);
  text-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
}

.theme-hacker .input-abort {
  color: rgba(255, 255, 255, 0.65);
  font-size: 1.1rem;
}

.theme-hacker .input-abort:hover {
  color: var(--hacker-primary);
  transform: translateX(-2px);
  text-shadow: 0 0 8px rgba(0, 255, 0, 0.35);
}

.theme-hacker .hacker-btn {
  padding: 12px 30px;
  font-size: 1rem;
  border-width: 1px;
  box-shadow: none;
  letter-spacing: 1px;
}

.theme-hacker .hacker-btn:hover {
  box-shadow: 0 0 8px rgba(0, 255, 0, 0.35);
}

.btn-secondary:hover {
  border-color: #fff;
  background: rgba(255,255,255,0.1);
}

.error-message {
  padding: 15px;
  background: rgba(239,68,68,0.2);
  border: 2px solid #ef4444;
  color: #fca5a5;
  border-radius: 0;
  margin-top: 20px;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

.spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Player Screen */
#player-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.novel-container {
  position: relative;
  width: min(96vw, calc(96vh * 16 / 9));
  height: min(96vh, calc(96vw * 9 / 16));
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  background: #000;
  display: block;
  --dialogue-height: clamp(220px, 34%, 380px);
  --dialogue-padding-top: 26px;
  --dialogue-padding-bottom: 24px;
  --dialogue-controls-height: 56px;
  --dialogue-scroll-gap: 0px;
  --dialogue-gap: 10px;
}

.theme-cyberpunk .novel-container {
  border-color: var(--cyber-primary);
  box-shadow: 0 0 30px rgba(255, 0, 255, 0.3);
}

.theme-hacker .novel-container {
  border-color: var(--hacker-primary);
  box-shadow: 0 0 30px rgba(0, 255, 0, 0.3);
}

.background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.theme-cyberpunk .background {
  --theme-gradient: radial-gradient(circle at center, rgba(255, 0, 255, 0.3) 0%, rgba(0, 0, 0, 1) 70%);
  background-image: var(--theme-gradient);
}

.theme-hacker .background {
  --theme-gradient: radial-gradient(circle at center, rgba(0, 255, 0, 0.2) 0%, rgba(0, 0, 0, 1) 70%);
  background-image: var(--theme-gradient);
}

.character-display {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  animation: fadeIn 1s ease-in-out;
  pointer-events: none;
  width: min(56vw, 760px);
  max-height: calc(100% - var(--dialogue-height) + 40px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

#character-avatar {
  width: 100%;
  height: auto;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  overflow: visible;
}

#character-avatar-img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  max-height: calc(100% - 12px);
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.55));
}

#character-avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8rem;
}

#character-avatar .is-hidden {
  display: none;
}

.theme-cyberpunk #character-avatar {
  border-color: transparent;
  box-shadow: none;
  background: transparent;
}

.theme-hacker #character-avatar {
  border-color: transparent;
  box-shadow: none;
  background: transparent;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) scale(0.9); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}

.hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(10px);
  z-index: 10;
  position: relative;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.theme-cyberpunk .hud-item {
  font-size: 1rem;
}

.hud-label {
  text-transform: uppercase;
  opacity: 0.6;
  letter-spacing: 1px;
}

.hud-value {
  font-weight: bold;
}

.dialogue-box {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--dialogue-padding-top) 32px var(--dialogue-padding-bottom);
  height: var(--dialogue-height);
  overflow: visible;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: var(--dialogue-gap);
  border-radius: 0;
}

.dialogue-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100% - var(--dialogue-padding-top) - var(--dialogue-padding-bottom));
  overflow-y: auto;
  padding-right: 6px;
  padding-bottom: calc(var(--dialogue-controls-height) + var(--dialogue-scroll-gap));
  scroll-padding-bottom: var(--dialogue-scroll-gap);
}

.theme-cyberpunk .dialogue-box {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 0%, rgba(5, 5, 16, 0.7) 28%, rgba(0, 0, 0, 0.88) 100%);
  backdrop-filter: blur(6px);
  border-top: 2px solid rgba(0, 255, 255, 0.45);
  box-shadow: 0 -12px 30px rgba(0, 255, 255, 0.18);
}

.theme-hacker .dialogue-box {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.75) 28%, rgba(0, 0, 0, 0.92) 100%);
  backdrop-filter: blur(6px);
  border-top: 2px solid rgba(0, 255, 0, 0.45);
  box-shadow: 0 -12px 30px rgba(0, 255, 0, 0.18);
}

.speaker-name {
  position: absolute;
  top: 0;
  left: 24px;
  bottom: auto;
  transform: translateY(-50%);
  padding: 6px 18px;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
  color: #000;
  z-index: 2;
  border-radius: 6px;
  max-width: calc(100% - 48px);
  white-space: normal;
  line-height: 1.2;
}

.theme-cyberpunk .speaker-name {
  background: var(--cyber-secondary);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.theme-hacker .speaker-name {
  background: var(--hacker-primary);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

#dialogue-text {
  font-size: 1.125rem;
  line-height: 1.75;
  font-weight: 500;
  min-height: 0;
  max-height: none;
  overflow: visible;
  padding-right: 0;
  white-space: pre-wrap;
}

.theme-cyberpunk #dialogue-text {
  font-size: 1.2rem;
}

#dialogue-text .typing-cursor {
  animation: blink 1s infinite;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.confirm-modal.is-open {
  display: flex;
}

.confirm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.confirm-modal__panel {
  position: relative;
  width: min(520px, 92vw);
  padding: 20px 22px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: var(--cyber-card);
  color: var(--cyber-text);
  clip-path: polygon(6% 0, 100% 0, 100% 88%, 94% 100%, 0 100%, 0 12%);
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.2);
  z-index: 1;
}

.confirm-modal__header {
  font-family: 'Orbitron', sans-serif;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
  color: var(--cyber-secondary);
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.confirm-modal__message {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.confirm-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.confirm-modal__actions .btn-control,
.confirm-modal__actions .cyber-btn {
  width: 110px;
  min-width: 110px;
  height: 36px;
  padding: 6px 14px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid currentColor;
  box-shadow: none;
  clip-path: none;
  box-sizing: border-box;
  line-height: 1;
  flex: 0 0 110px;
  text-align: center;
}

.confirm-modal__actions .btn-control {
  border-color: currentColor;
}

.confirm-modal__actions .btn-control:hover {
  background: currentColor;
  color: #000;
}

.confirm-modal__actions .cyber-btn {
  border-width: 1px;
}

.confirm-modal__actions .cyber-btn:hover {
  background: currentColor;
  color: #000;
}

.confirm-modal__actions #confirm-ok,
.confirm-modal__actions #confirm-cancel {
  width: 96px !important;
  min-width: 96px !important;
  flex: 0 0 96px !important;
  height: 36px !important;
  padding: 6px 12px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 6px;
  clip-path: none;
}

.confirm-modal__actions #confirm-cancel:hover {
  background: transparent;
  color: currentColor;
}

.theme-cyberpunk .confirm-modal__actions .btn-control:hover,
.theme-cyberpunk .confirm-modal__actions .cyber-btn:hover {
  background: var(--cyber-primary);
  color: #0a0e27;
}

.theme-hacker .confirm-modal__actions .btn-control:hover,
.theme-hacker .confirm-modal__actions .cyber-btn:hover {
  background: var(--hacker-primary);
  color: #001200;
}

.theme-cyberpunk .confirm-modal__actions #confirm-cancel:hover,
.theme-hacker .confirm-modal__actions #confirm-cancel:hover {
  background: transparent;
  color: currentColor;
}

.confirm-modal__actions .btn-control::after {
  content: none;
}

.theme-cyberpunk .confirm-modal__actions .btn-control,
.theme-cyberpunk .confirm-modal__actions .cyber-btn {
  color: var(--cyber-primary);
  border-color: var(--cyber-primary);
}

.theme-hacker .confirm-modal__panel {
  background: rgba(0, 17, 0, 0.78);
  color: var(--hacker-text);
  border-color: rgba(0, 255, 0, 0.35);
  box-shadow: 0 0 25px rgba(0, 255, 0, 0.2), inset 0 0 12px rgba(0, 255, 0, 0.08);
}

.theme-hacker .confirm-modal__header {
  font-family: 'Share Tech Mono', monospace;
  color: var(--hacker-primary);
  text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.theme-hacker .confirm-modal__actions .btn-control,
.theme-hacker .confirm-modal__actions .cyber-btn {
  color: var(--hacker-primary);
  border-color: var(--hacker-primary);
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.choices-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  justify-content: flex-start;
  margin: 6px 0 0;
  max-height: none;
  overflow: visible;
  padding-right: 8px;
  padding-bottom: 0;
}

.choice-btn {
  padding: 12px 24px;
  border: 1px solid;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 0.875rem;
  text-align: left;
  transition: all 0.3s;
  border-radius: 2px;
  width: 100%;
  min-width: 0;
  text-transform: none;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: normal;
  line-height: 1.4;
  display: block;
}

.theme-cyberpunk .choice-btn {
  border-color: var(--cyber-primary);
  background: transparent;
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.18);
}

.theme-hacker .choice-btn {
  border-color: var(--hacker-primary);
  background: transparent;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.18);
}

.choice-btn:hover {
  transform: translateX(6px);
}

.choice-btn.is-disabled,
.choice-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.theme-cyberpunk .choice-btn:hover {
  background: var(--cyber-primary);
  color: #000;
  box-shadow: 0 0 18px rgba(255, 0, 255, 0.6), inset 0 0 10px rgba(255, 0, 255, 0.25);
}

.theme-hacker .choice-btn:hover {
  background: var(--hacker-primary);
  color: #000;
  box-shadow: 0 0 18px rgba(0, 255, 0, 0.55), inset 0 0 10px rgba(0, 255, 0, 0.2);
}

.dialogue-controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 8px;
}

.dialogue-actions {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-top: 6px;
}

.progress-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.theme-cyberpunk .progress-bar {
  font-size: 1.1rem;
}

#progress-text {
  font-weight: bold;
}

.theme-cyberpunk #progress-text {
  color: var(--cyber-primary);
}

.theme-hacker #progress-text {
  color: var(--hacker-primary);
}

.frame-meta {
  font-size: 0.75rem;
  opacity: 0.6;
}

.theme-cyberpunk .frame-meta {
  font-size: 0.85rem;
}

.btn-next {
  padding: 10px 20px;
  border: 1px solid rgba(255,255,255,0.35);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.35));
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.6px;
  transition: all 0.3s;
  border-radius: 6px;
  backdrop-filter: blur(5px);
}

.theme-cyberpunk .btn-next {
  border-color: var(--cyber-primary);
  color: var(--cyber-primary);
  box-shadow: 0 0 12px rgba(255, 0, 255, 0.2);
}

.theme-hacker .btn-next {
  border-color: var(--hacker-primary);
  color: var(--hacker-primary);
  box-shadow: 0 0 12px rgba(0, 255, 0, 0.2);
}

.theme-cyberpunk .btn-next:hover {
  background: rgba(255, 0, 255, 0.12);
  box-shadow: 0 0 16px rgba(255, 0, 255, 0.35);
  transform: translateY(-1px);
}

.theme-hacker .btn-next:hover {
  background: rgba(0, 255, 0, 0.12);
  box-shadow: 0 0 16px rgba(0, 255, 0, 0.3);
  transform: translateY(-1px);
}

.control-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 20;
  display: flex;
  gap: 10px;
}

.btn-control {
  padding: 8px 16px;
  border: 1px solid rgba(255,255,255,0.35);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.35));
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.3s;
  border-radius: 6px;
  backdrop-filter: blur(5px);
  position: relative;
  overflow: hidden;
}

#restart-btn {
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.75);
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  margin-top: 0;
  align-self: center;
}

#restart-btn:hover,
.theme-cyberpunk #restart-btn:hover,
.theme-hacker #restart-btn:hover {
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
  background: transparent;
}

#restart-btn::after {
  content: none;
}

.btn-control::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  opacity: 0.25;
}

.theme-cyberpunk .btn-control:hover {
  border-color: var(--cyber-primary);
  color: var(--cyber-primary);
}

.theme-hacker .btn-control:hover {
  border-color: var(--hacker-primary);
  color: var(--hacker-primary);
}

/* Utilities */
.selected {
  opacity: 1 !important;
}

/* Animate-in effects */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#setup-screen.active {
  animation: slideUp 0.7s ease-out;
}

@media (max-width: 900px) {
  .novel-container {
    --dialogue-height: clamp(240px, 46%, 380px);
    --dialogue-padding-top: 20px;
    --dialogue-padding-bottom: 22px;
    --dialogue-controls-height: 50px;
    --dialogue-scroll-gap: 0px;
  }

  .dialogue-box {
    left: 0;
    right: 0;
    bottom: 0;
    padding: var(--dialogue-padding-top) 18px var(--dialogue-padding-bottom);
  }

  .dialogue-scroll {
    max-height: calc(100% - var(--dialogue-padding-top) - var(--dialogue-padding-bottom));
    padding-bottom: calc(var(--dialogue-controls-height) + var(--dialogue-scroll-gap));
  }

  .character-display {
    width: min(68vw, 420px);
    max-height: calc(100% - var(--dialogue-height) + 12px);
  }

  #dialogue-text {
    font-size: 1rem;
    line-height: 1.6;
  }

}




