/* ================================================================
   Python Together — style.css
   Warm, playful, light theme. Couples coding together.
   ================================================================ */

/* ----------------------------------------------------------------
   0. DESIGN TOKENS
   ---------------------------------------------------------------- */
:root {
  /* Core palette — warm light with personality */
  --bg-deep:          #FAF7F2;
  --bg-main:          #FFFFFF;
  --bg-panel:         #FFFFFF;
  --bg-panel-hover:   #FFF8F0;
  --bg-editor:        #FAFAFA;
  --bg-input:         #F5F2ED;
  --bg-chat:          #FAF7F2;

  /* Brand — Warm Coral/Peach */
  --brand:            #FF6B6B;
  --brand-dark:       #E85555;
  --brand-soft:       #FF6B6B18;
  --brand-glow:       #FF6B6B12;

  /* Secondary — Teal (for "Run" and success) */
  --teal:             #2EC4B6;
  --teal-dark:        #1FAD9F;
  --teal-soft:        #2EC4B615;

  /* Player colors — me = teal, her = coral */
  --me-color:         #2EC4B6;
  --me-dark:          #1FAD9F;
  --me-bg:            #2EC4B610;
  --me-border:        #2EC4B630;
  --me-glow:          #2EC4B620;
  --me-bubble:        #F0FDFB;

  --her-color:        #FF6B6B;
  --her-dark:         #E85555;
  --her-bg:           #FF6B6B10;
  --her-border:       #FF6B6B30;
  --her-glow:         #FF6B6B20;
  --her-bubble:       #FFF5F5;
  --her-panel-bg:     #FFFAFA;

  /* Text — warm charcoal */
  --text-primary:     #2D2A26;
  --text-secondary:   #7A7570;
  --text-muted:       #B5AFA8;
  --text-code:        #3D3832;

  /* Accents */
  --green:            #2EC4B6;
  --green-bright:     #3DD8CA;
  --green-bg:         #2EC4B620;
  --error:            #F04438;
  --error-bg:         #F0443812;
  --warning:          #FFB020;

  /* System */
  --border:           #EBE7E0;
  --border-subtle:    #F2EFEA;

  /* Typography */
  --font-display:     'Fredoka', sans-serif;
  --font-body:        'Nunito', sans-serif;
  --font-mono:        'Fira Code', monospace;

  /* Spacing */
  --radius-sm:        10px;
  --radius-md:        16px;
  --radius-lg:        24px;
  --radius-xl:        32px;
  --radius-full:      100px;

  /* Shadows — soft & warm */
  --shadow-sm:        0 1px 3px rgba(45,42,38,0.06);
  --shadow-md:        0 4px 12px rgba(45,42,38,0.08);
  --shadow-lg:        0 8px 24px rgba(45,42,38,0.1);
  --shadow-btn:       0 4px 0 var(--border);
}

/* ----------------------------------------------------------------
   1. RESET & BASE
   ---------------------------------------------------------------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 700;
}

a:hover {
  color: var(--brand-dark);
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--brand);
  font-weight: 600;
}

/* ----------------------------------------------------------------
   2. SCREEN MANAGEMENT
   ---------------------------------------------------------------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.hidden {
  display: none !important;
}

/* ----------------------------------------------------------------
   3. ANIMATIONS
   ---------------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.9) translateY(10px); }
  60% { transform: scale(1.02) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ----------------------------------------------------------------
   4. LOADING SCREEN
   ---------------------------------------------------------------- */
.loading-screen {
  background: var(--bg-deep);
  justify-content: center;
  align-items: center;
  gap: 28px;
}

.loading-snake {
  font-size: 56px;
  animation: float 2s ease-in-out infinite;
}

.loading-title {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.5px;
}

.loading-subtitle {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
}

.loading-bar-container {
  width: 260px;
  height: 16px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 2px solid var(--border);
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-full);
  background: var(--teal);
  transition: width 0.3s ease;
}

/* ----------------------------------------------------------------
   5. IDENTITY SCREEN
   ---------------------------------------------------------------- */
.identity-screen {
  background: var(--bg-deep);
  justify-content: center;
  align-items: center;
  gap: 48px;
}

.identity-header {
  text-align: center;
  animation: fadeIn 0.6s ease;
}

.identity-brand {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.identity-brand .highlight {
  color: var(--brand);
}

.identity-question {
  font-size: 18px;
  color: var(--text-secondary);
  font-weight: 600;
}

.identity-buttons {
  display: flex;
  gap: 32px;
  animation: slideUp 0.6s ease 0.2s both;
}

.identity-btn {
  width: 200px;
  padding: 36px 24px;
  border-radius: var(--radius-xl);
  border: 3px solid var(--border);
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-md), 0 4px 0 var(--border);
}

.identity-btn:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), 0 6px 0 var(--border);
}

.identity-btn:active {
  transform: translateY(2px);
  box-shadow: var(--shadow-sm), 0 1px 0 var(--border);
}

.identity-btn-vikas:hover {
  border-color: var(--me-color);
}

.identity-btn-ishika:hover {
  border-color: var(--her-color);
}

.identity-emoji {
  font-size: 48px;
}

.identity-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}

.identity-btn-vikas .identity-name {
  color: var(--me-dark);
}

.identity-btn-ishika .identity-name {
  color: var(--her-dark);
}

.identity-footer {
  color: var(--text-muted);
  font-size: 13px;
  animation: fadeIn 0.6s ease 0.4s both;
}

.identity-footer a {
  color: var(--text-secondary);
}

/* ----------------------------------------------------------------
   6. CONVERSATIONS SCREEN
   ---------------------------------------------------------------- */
.conversations-screen {
  background: var(--bg-deep);
}

.conv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 2px solid var(--border);
  background: var(--bg-main);
}

.conv-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.conv-brand-icon {
  font-size: 24px;
}

.conv-brand-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}

.conv-brand-text .highlight {
  color: var(--brand);
}

.conv-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.conv-partner-name {
  font-weight: 700;
  color: var(--her-dark);
  font-size: 14px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-main);
  border: 2px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--teal);
  box-shadow: 0 0 6px var(--teal-soft);
}

.status-label {
  font-family: var(--font-body);
  font-weight: 700;
}

/* Conversations main area */
.conv-main {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.btn-new-conv {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 2px dashed var(--brand);
  color: var(--brand);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  transition: all 0.2s ease;
  background: transparent;
  width: 100%;
  margin-bottom: 8px;
}

.btn-new-conv:hover {
  background: var(--brand-soft);
  transform: translateY(-2px);
}

.btn-new-icon {
  font-size: 22px;
  font-weight: 300;
}

/* Conversation list */
.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Conversation card */
.conversation-card {
  padding: 18px 22px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  background: var(--bg-main);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.conversation-card:hover {
  background: var(--bg-panel-hover);
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.conv-card-body {
  flex: 1;
  min-width: 0;
}

.conv-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.conv-author {
  color: var(--text-secondary);
  font-weight: 700;
}

.conv-time {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.conv-delete {
  opacity: 0;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
}

.conversation-card:hover .conv-delete {
  opacity: 0.6;
}

.conv-delete:hover {
  opacity: 1 !important;
  color: var(--error);
  background: var(--error-bg);
}

/* Empty state */
.conv-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.conv-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

.conv-empty-text {
  font-size: 16px;
  font-weight: 600;
}

/* Footer */
.conv-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.conv-footer a {
  font-weight: 700;
}

/* ----------------------------------------------------------------
   7. ARENA SCREEN
   ---------------------------------------------------------------- */
.arena-screen {
  background: var(--bg-deep);
}

/* Arena header */
.arena-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 2px solid var(--border);
  background: var(--bg-main);
  min-height: 52px;
  z-index: 10;
  flex-shrink: 0;
}

.arena-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-back {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
  font-weight: 700;
  border: 2px solid var(--border);
  background: var(--bg-main);
}

.btn-back:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-soft);
}

.arena-header-center {
  text-align: center;
}

.arena-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arena-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.arena-partner-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--her-dark);
  font-weight: 700;
}

.typing-badge {
  font-size: 11px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--warning);
  color: #7A5900;
  font-weight: 800;
  animation: pulse 1.5s ease infinite;
}

/* Three-panel layout */
.arena-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(380px, 1.6fr) minmax(260px, 1fr);
  gap: 0;
  overflow: hidden;
}

/* ----------------------------------------------------------------
   8. PANEL LABELS (shared)
   ---------------------------------------------------------------- */
.panel-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 2px solid var(--border);
  background: var(--bg-main);
  flex-shrink: 0;
}

.panel-label-icon {
  font-size: 14px;
}

.panel-label-me {
  color: var(--me-dark);
  border-bottom-color: var(--me-border);
}

.panel-label-chat {
  color: var(--text-secondary);
  border-bottom-color: var(--border);
}

.panel-label-her {
  color: var(--her-dark);
  border-bottom-color: var(--her-border);
}

/* ----------------------------------------------------------------
   9. LEFT PANEL — My Editor
   ---------------------------------------------------------------- */
.panel-me {
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--border);
  background: var(--bg-editor);
  min-height: 0;
}

/* Editor history */
.editor-history {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-entry {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: var(--bg-main);
  border: 2px solid var(--border);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  box-shadow: var(--shadow-sm);
  animation: scaleIn 0.2s ease;
}

.history-code {
  color: var(--text-code);
  display: flex;
  gap: 10px;
  white-space: pre-wrap;
  word-break: break-all;
}

.history-code .prompt {
  color: var(--me-color);
  user-select: none;
  flex-shrink: 0;
  font-weight: 600;
}

.history-result {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  color: var(--text-secondary);
  font-size: 12px;
}

.history-entry.error {
  border-color: var(--error);
  background: var(--error-bg);
}

.history-entry.error .history-result {
  color: var(--error);
}

/* Editor input area */
.editor-input-area {
  padding: 16px;
  border-top: 2px solid var(--border);
  background: var(--bg-main);
  flex-shrink: 0;
}

.editor-prompt-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: all 0.2s ease;
}

.editor-prompt-row:focus-within {
  border-color: var(--me-color);
  background: var(--bg-main);
  box-shadow: 0 0 0 3px var(--me-glow);
}

.prompt-symbol {
  font-family: var(--font-mono);
  color: var(--me-color);
  font-size: 14px;
  line-height: 1.6;
  user-select: none;
  flex-shrink: 0;
  font-weight: 600;
}

.code-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-code);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  min-height: 24px;
  max-height: 160px;
  width: 100%;
}

.code-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.editor-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
}

.btn-run {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 24px;
  border-radius: var(--radius-full);
  background: var(--teal);
  color: white;
  transition: all 0.15s ease;
  box-shadow: 0 3px 0 var(--teal-dark);
}

.btn-run:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 0 var(--teal-dark);
}

.btn-run:active {
  transform: translateY(3px);
  box-shadow: 0 0px 0 var(--teal-dark);
}

/* ----------------------------------------------------------------
   10. CENTER PANEL — Chat
   ---------------------------------------------------------------- */
.panel-chat {
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
  position: relative;
  min-height: 0;
}

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Chat welcome */
.chat-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 20px;
  padding: 40px 20px;
  animation: fadeIn 0.5s ease;
}

.welcome-hero {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  line-height: 1.15;
}

.welcome-hero .line1 {
  color: var(--text-primary);
}

.welcome-hero .line2 {
  color: var(--brand);
}

.welcome-sub {
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 600;
}

.welcome-heart {
  color: var(--brand);
}

.welcome-hints {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.welcome-hint {
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--bg-main);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.welcome-hint code {
  color: var(--brand);
  font-weight: 700;
}

.welcome-hint .arrow {
  color: var(--text-muted);
  margin: 0 6px;
}

/* ----------------------------------------------------------------
   11. CHAT MESSAGES
   ---------------------------------------------------------------- */
.msg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 85%;
  animation: scaleIn 0.25s ease;
}

.msg-me {
  align-self: flex-start;
}

.msg-partner {
  align-self: flex-end;
}

.msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.msg-me .msg-header {
  flex-direction: row;
}

.msg-partner .msg-header {
  flex-direction: row-reverse;
}

.msg-player {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
}

.msg-me .msg-player {
  color: var(--me-dark);
}

.msg-partner .msg-player {
  color: var(--her-dark);
}

.msg-time {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.msg-bubble {
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  border: 2px solid;
  box-shadow: var(--shadow-sm);
}

.msg-me .msg-bubble {
  background: var(--bg-main);
  border-color: var(--me-border);
  border-bottom-left-radius: 6px;
}

.msg-partner .msg-bubble {
  background: var(--bg-main);
  border-color: var(--her-border);
  border-bottom-right-radius: 6px;
}

/* Code block inside message */
.msg-code-block {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px dashed var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.5;
  display: flex;
  gap: 8px;
  white-space: pre-wrap;
  word-break: break-all;
}

.msg-code-block .prompt {
  color: var(--text-muted);
  user-select: none;
  flex-shrink: 0;
}

/* Output = THE message, big and bold */
.msg-output {
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text-primary);
}

/* Error message */
.msg-error .msg-bubble {
  background: #FFF5F4;
  border-color: var(--error);
  border-style: solid;
}

.msg-error .msg-code-block {
  border-color: rgba(240,68,56,0.2);
  background: rgba(240,68,56,0.05);
}

.msg-error .msg-output {
  color: var(--error);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
}

/* ----------------------------------------------------------------
   12. TYPING INDICATOR (bottom of chat)
   ---------------------------------------------------------------- */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  border-top: 2px solid var(--border);
  background: var(--bg-main);
  flex-shrink: 0;
}

.chat-typing.hidden {
  display: none !important;
}

.chat-typing-name {
  color: var(--her-dark);
  font-weight: 800;
}

.chat-typing-text {
  color: var(--text-muted);
}

.typing-dots {
  display: inline-flex;
  gap: 1px;
  margin-left: 2px;
}

.typing-dots span {
  display: inline-block;
  animation: typingDot 1.4s infinite ease-in-out both;
  font-weight: 900;
  font-size: 18px;
  color: var(--her-color);
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

/* ----------------------------------------------------------------
   13. RIGHT PANEL — Partner's Editor
   ---------------------------------------------------------------- */
.panel-her {
  display: flex;
  flex-direction: column;
  border-left: 2px solid var(--border);
  background: var(--her-panel-bg);
  min-height: 0;
}

.her-editor-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Her live code entries */
.her-live-code {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-left: 4px solid var(--her-color);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-code);
  position: relative;
  box-shadow: var(--shadow-sm);
  animation: scaleIn 0.2s ease;
}

.her-live-code.typing {
  animation: fadeIn 0.25s ease;
  transition: opacity 0.2s ease, transform 0.2s ease;
  border-left-color: var(--warning);
  border-color: var(--warning);
  background: var(--bg-panel-hover);
}

.her-live-code.typing::after {
  content: '▊';
  color: var(--her-color);
  animation: blink 1s step-end infinite;
}

.her-live-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.her-live-label.typing-now {
  color: var(--warning);
}

.her-code-line {
  display: flex;
  gap: 10px;
  white-space: pre-wrap;
  word-break: break-all;
}

.her-code-line .prompt {
  color: var(--her-color);
  user-select: none;
  flex-shrink: 0;
  font-weight: 600;
}

.her-live-result {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.her-live-result.error-text {
  color: var(--error);
}

.her-live-code.error-entry {
  border-color: var(--error);
  border-left-color: var(--error);
  background: var(--error-bg);
}

/* Her status footer */
.her-status-footer {
  padding: 14px 20px;
  border-top: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  background: var(--bg-main);
  flex-shrink: 0;
}

.her-status-name {
  color: var(--her-dark);
}

.her-status-text {
  color: var(--text-muted);
}

/* Waiting for partner */
.her-waiting {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  padding: 40px 20px;
}

.her-waiting-emoji {
  font-size: 48px;
  animation: float 3s ease-in-out infinite;
}

.her-waiting-text {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}

.her-waiting-sub {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

/* ----------------------------------------------------------------
   14. SCROLLBAR STYLING
   ---------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ----------------------------------------------------------------
   15. INVITE SECTION
   ---------------------------------------------------------------- */
.invite-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.btn-invite {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border);
  background: var(--bg-main);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s ease;
  cursor: pointer;
  width: 100%;
  max-width: 400px;
}

.btn-invite:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-soft);
  transform: translateY(-1px);
}

.invite-icon {
  font-size: 16px;
}

.invite-copied {
  font-size: 13px;
  font-weight: 700;
  color: var(--teal);
  animation: fadeIn 0.3s ease;
}

/* ----------------------------------------------------------------
   15b. FOOTER RENAME LINK
   ---------------------------------------------------------------- */
.footer-identity {
  font-size: 13px;
  color: var(--text-muted);
}

.footer-rename {
  font-size: 12px;
}

.footer-rename a {
  color: var(--text-muted);
  font-weight: 600;
  transition: color 0.2s ease;
}

.footer-rename a:hover {
  color: var(--her-color);
}

/* ----------------------------------------------------------------
   15c. RENAME MODAL
   ---------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-box {
  background: var(--bg-main);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  width: 520px;
  max-width: 92vw;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--border);
  text-align: center;
  animation: scaleIn 0.25s ease;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.modal-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 20px;
}

.modal-input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  outline: none;
  transition: all 0.2s ease;
  text-align: center;
}

.modal-input:focus {
  border-color: var(--brand);
  background: var(--bg-main);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.modal-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
}

.modal-btn {
  padding: 10px 28px;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 2px solid transparent;
}

.modal-btn-cancel {
  background: var(--bg-input);
  color: var(--text-secondary);
  border-color: var(--border);
}

.modal-btn-cancel:hover {
  background: var(--border);
}

.modal-btn-confirm {
  background: var(--brand);
  color: white;
  box-shadow: 0 3px 0 var(--brand-dark);
}

.modal-btn-confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 0 var(--brand-dark);
}

.modal-btn-confirm:active {
  transform: translateY(2px);
  box-shadow: 0 0px 0 var(--brand-dark);
}

/* ----------------------------------------------------------------
   16. RESPONSIVE
   ---------------------------------------------------------------- */
@media (max-width: 1100px) {
  .arena-body {
    grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.4fr) minmax(220px, 1fr);
  }
  .msg-output { font-size: 15px; }
  .welcome-hero { font-size: 32px; }
}

@media (max-width: 900px) {
  .arena-body {
    grid-template-columns: 1fr 1.2fr 1fr;
  }
  .panel-label {
    font-size: 11px;
    padding: 10px 14px;
  }
  .editor-input-area { padding: 12px; }
  .chat-area { padding: 14px; }
  .msg { max-width: 92%; }
}

/* ----------------------------------------------------------------
   16. DARK MODE — auto-activates after 7 PM IST
   Darker shades with good contrast & visibility.
   ---------------------------------------------------------------- */
body.dark-mode {
  --bg-deep:          #1A1A2E;
  --bg-main:          #222240;
  --bg-panel:         #222240;
  --bg-panel-hover:   #2A2A4A;
  --bg-editor:        #1E1E38;
  --bg-input:         #2A2A4A;
  --bg-chat:          #1A1A2E;

  /* Brand — Warm Coral (stays vibrant on dark) */
  --brand:            #FF7B7B;
  --brand-dark:       #FF9595;
  --brand-soft:       #FF6B6B20;
  --brand-glow:       #FF6B6B15;

  /* Secondary — Teal */
  --teal:             #3DD8CA;
  --teal-dark:        #2AB8AB;
  --teal-soft:        #2EC4B625;

  /* Player colors — me = teal, her = coral */
  --me-color:         #3DD8CA;
  --me-dark:          #5AE8DC;
  --me-bg:            #2EC4B615;
  --me-border:        #2EC4B640;
  --me-glow:          #2EC4B625;
  --me-bubble:        #1C2F2D;

  --her-color:        #FF7B7B;
  --her-dark:         #FF9595;
  --her-bg:           #FF6B6B15;
  --her-border:       #FF6B6B40;
  --her-glow:         #FF6B6B25;
  --her-bubble:       #2F1C1C;
  --her-panel-bg:     #1F1A2E;

  /* Text — light on dark */
  --text-primary:     #E8E6F0;
  --text-secondary:   #A8A4B8;
  --text-muted:       #6B6780;
  --text-code:        #D0CDE0;

  /* Accents */
  --green:            #3DD8CA;
  --green-bright:     #5AE8DC;
  --green-bg:         #2EC4B625;
  --error:            #FF6B6B;
  --error-bg:         #FF444420;
  --warning:          #FFB020;

  /* System */
  --border:           #3A3754;
  --border-subtle:    #2E2B44;

  /* Shadows — subtler on dark */
  --shadow-sm:        0 1px 3px rgba(0,0,0,0.2);
  --shadow-md:        0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg:        0 8px 24px rgba(0,0,0,0.35);
  --shadow-btn:       0 4px 0 var(--border);
}

/* Dark mode specific overrides for elements with hardcoded colors */
body.dark-mode .msg-error .msg-bubble {
  background: #2F1A1A;
  border-color: var(--error);
}

body.dark-mode .msg-error .msg-code-block {
  border-color: rgba(255,107,107,0.25);
  background: rgba(255,107,107,0.08);
}

body.dark-mode .identity-btn {
  box-shadow: var(--shadow-md), 0 4px 0 var(--border);
}

body.dark-mode .identity-btn:hover {
  box-shadow: var(--shadow-lg), 0 6px 0 var(--border);
}

body.dark-mode .identity-btn:active {
  box-shadow: var(--shadow-sm), 0 1px 0 var(--border);
}

body.dark-mode .typing-badge {
  background: #4A3800;
  color: #FFD060;
}

body.dark-mode .btn-run {
  box-shadow: 0 3px 0 var(--teal-dark);
}

body.dark-mode .btn-run:hover {
  box-shadow: 0 4px 0 var(--teal-dark);
}

body.dark-mode .btn-run:active {
  box-shadow: 0 0px 0 var(--teal-dark);
}

/* Smooth transition when mode changes */
body {
  transition: background-color 0.4s ease, color 0.4s ease;
}

body.dark-mode *,
body.dark-mode *::before,
body.dark-mode *::after {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* ================================================================
   Inline SVG Icons
   ================================================================ */

.icon-inline {
  display: inline-block;
  vertical-align: middle;
  margin-left: 4px;
  position: relative;
  top: -1px;
}

/* ================================================================
   Error Cards (Editor History)
   ================================================================ */

.error-card {
  margin-top: 8px;
  padding: 14px 16px;
  background: rgba(240, 68, 56, 0.06);
  border: 1.5px solid rgba(240, 68, 56, 0.2);
  border-left: 4px solid var(--error);
  border-radius: 10px;
  animation: fadeIn 0.3s ease;
}

.error-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.error-card-icon {
  display: flex;
  align-items: center;
  color: var(--error);
  flex-shrink: 0;
}

.error-card-type {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--error);
}

.error-card-emoji {
  margin-left: auto;
  font-size: 18px;
}

.error-card-msg {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
  padding-left: 26px;
}

.error-card-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 186, 24, 0.08);
  border: 1.5px dashed rgba(255, 186, 24, 0.3);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--warning);
  line-height: 1.5;
}

.hint-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--warning);
  margin-top: 1px;
}

/* Dark mode error card adjustments */
body.dark-mode .error-card {
  background: rgba(240, 68, 56, 0.08);
  border-color: rgba(240, 68, 56, 0.25);
}

body.dark-mode .error-card-hint {
  background: rgba(255, 186, 24, 0.06);
  border-color: rgba(255, 186, 24, 0.2);
}
