@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

:root {
  --bg: #1a1208;
  --panel: #231808;
  --border: #3a2a14;
  --text: #e8d8b0;
  --dim: #907050;
  --pink: #ff7aaa;
  --gold: #ffcc44;
  --green: #50e090;
  --red: #ff5565;
  --purple: #b87aff;
  --amber: #c87828;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Press Start 2P', 'Courier New', monospace;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#game-container {
  display: flex;
  width: 100%;
  height: 100%;
}

#world {
  flex: 1;
  position: relative;
  background: linear-gradient(180deg, #2c1e0c 0%, #1a1208 100%);
  border-right: 2px solid #4a3520;
  overflow: hidden;
}

#world::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(180, 90, 10, 0.018) 0px,
    rgba(180, 90, 10, 0.018) 1px,
    transparent 1px,
    transparent 5px
  );
  pointer-events: none;
  z-index: 10;
}

#world::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(10, 5, 0, 0.55) 100%);
  pointer-events: none;
  z-index: 11;
}

#world-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#sidebar {
  width: 400px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #261c0a 0%, #1c1408 100%);
  overflow: hidden;
  border-left: 2px solid #5a3e20;
  box-shadow: inset 2px 0 20px rgba(180, 100, 20, 0.08), -2px 0 12px rgba(0,0,0,0.5);
}

.panel {
  padding: 10px;
  border-bottom: 1px solid #3a2a14;
  background: linear-gradient(180deg, rgba(255,160,40,0.025) 0%, transparent 100%);
}

.panel-header {
  font-size: 0.5rem;
  color: var(--gold);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
  text-shadow: 0 0 8px rgba(255, 200, 50, 0.6), 0 0 20px rgba(255, 150, 20, 0.2);
}

#profile-panel {
  flex-shrink: 0;
}

.profile-name {
  font-size: 0.65rem;
  color: var(--pink);
  margin-bottom: 6px;
  text-shadow: 0 0 6px rgba(255, 107, 157, 0.5);
}

.profile-stat {
  font-size: 0.5rem;
  color: var(--dim);
  margin: 4px 0;
  line-height: 1.6;
}

.profile-stat span {
  color: var(--text);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: bottom;
}

.hidden {
  display: none;
}

.profile-lore {
  font-size: 0.42rem;
  color: #b8986a;
  font-style: italic;
  margin: 6px 0 2px;
  line-height: 1.7;
  min-height: 0;
}

.marriage-status {
  margin-top: 8px;
  padding: 8px;
  background: rgba(180, 100, 30, 0.12);
  border: 1px solid #6a4820;
  border-radius: 3px;
  font-size: 0.45rem;
  line-height: 1.8;
}

.marriage-status.married {
  background: rgba(255, 107, 157, 0.15);
  border-color: var(--pink);
}

.aura-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

#actions-panel {
  flex-shrink: 0;
}

.actions-row {
  display: flex;
  gap: 5px;
  margin-bottom: 4px;
}

.action-btn {
  flex: 1;
  padding: 5px 3px;
  background: rgba(255, 107, 157, 0.15);
  border: 2px solid var(--pink);
  color: var(--pink);
  font-family: inherit;
  font-size: 0.38rem;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.1s;
  text-shadow: 0 0 4px rgba(255, 107, 157, 0.5);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.action-btn:hover:not(:disabled) {
  background: rgba(255, 107, 157, 0.3);
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.action-btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}

.action-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.action-btn.danger {
  background: rgba(255, 85, 101, 0.1);
  border-color: var(--red);
  color: var(--red);
}

.action-btn.danger:hover:not(:disabled) {
  background: rgba(255, 85, 101, 0.25);
}

.action-btn.suite {
  background: rgba(147, 112, 219, 0.1);
  border-color: #9370db;
  color: #9370db;
}

.action-btn.suite:hover:not(:disabled) {
  background: rgba(147, 112, 219, 0.25);
}

.action-btn.suite.in-suite {
  background: rgba(255, 105, 180, 0.2);
  border-color: #ff69b4;
  color: #ff69b4;
  animation: suitePulse 2s ease-in-out infinite;
}

@keyframes suitePulse {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 105, 180, 0.3); }
  50% { box-shadow: 0 0 15px rgba(255, 105, 180, 0.6); }
}

#chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid #3a2a14;
  border-radius: 3px;
  font-family: 'Segoe UI', system-ui, Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: normal;
  line-height: 1.5;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
}

.chat-msg {
  margin-bottom: 5px;
  word-wrap: break-word;
  font-weight: normal;
}

.chat-msg.system {
  color: var(--gold);
  font-size: 0.72rem;
}

.chat-msg .sender {
  color: var(--pink);
  font-weight: bold;
}

#chat-input-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

#chat-input {
  flex: 1;
  background: #150e04;
  border: 1px solid #3a2a14;
  color: var(--text);
  font-family: 'Segoe UI', system-ui, Arial, sans-serif;
  font-size: 0.8rem;
  padding: 8px;
  border-radius: 3px;
  outline: none;
}

#chat-input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 10px rgba(200, 120, 40, 0.3);
}

#chat-send {
  padding: 8px 12px;
  background: var(--pink);
  border: 2px solid #ff4080;
  color: #fff;
  font-family: inherit;
  font-size: 0.45rem;
  border-radius: 0;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}

#chat-send:hover {
  background: #ff4080;
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

#chat-send:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}

#players-panel {
  flex-shrink: 0;
}

.players-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.players-select {
  flex: 1;
  min-width: 0;
  padding: 7px 8px;
  background: #150e04;
  border: 1px solid #3a2a14;
  color: var(--text);
  font-family: inherit;
  font-size: 0.45rem;
  border-radius: 3px;
  cursor: pointer;
  outline: none;
}

.players-select:focus {
  border-color: var(--amber);
  box-shadow: 0 0 8px rgba(200, 120, 40, 0.3);
  font-size: 0.65rem;
}

.players-select option {
  background: var(--bg);
  color: var(--text);
  font-size: 0.65rem;
}

#players-panel .action-btn.profile-btn {
  flex: 0 0 auto;
}

#proposal-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

#proposal-modal.visible {
  display: flex;
}

.modal-box {
  background: #231808;
  border: 2px solid #5a3e20;
  border-radius: 4px;
  padding: 24px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255,200,100,0.08);
}

.modal-box h2 {
  color: var(--pink);
  font-size: 0.7rem;
  margin-bottom: 16px;
  text-shadow: 0 0 10px rgba(255, 107, 157, 0.6);
}

.modal-box p {
  color: var(--text);
  font-size: 0.5rem;
  margin-bottom: 24px;
  line-height: 1.8;
}

.modal-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.modal-btn {
  padding: 12px 24px;
  border: 3px solid;
  border-radius: 0;
  font-family: inherit;
  font-size: 0.5rem;
  cursor: pointer;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
  transition: all 0.1s;
}

.modal-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.3);
}

.modal-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.modal-btn.accept {
  background: var(--green);
  border-color: #30c070;
  color: #000;
}

.modal-btn.reject {
  background: var(--red);
  border-color: #dd3040;
  color: #fff;
}

#hud {
  position: fixed;
  top: 10px;
  left: 10px;
  font-size: 0.65rem;
  color: var(--dim);
  pointer-events: none;
}

#connection-status {
  position: fixed;
  top: 10px;
  right: 410px;
  font-size: 0.65rem;
  padding: 4px 8px;
  border-radius: 3px;
}

#connection-status.connected {
  background: rgba(80, 224, 144, 0.2);
  color: var(--green);
}

#connection-status.disconnected {
  background: rgba(255, 85, 101, 0.2);
  color: var(--red);
}

.drunk-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: transparent;
  transition: background 0.5s;
  z-index: 50;
}

.drunk-overlay.level-1 { background: rgba(255, 200, 200, 0.05); }
.drunk-overlay.level-2 { background: rgba(255, 150, 150, 0.1); }
.drunk-overlay.level-3 { background: rgba(255, 100, 100, 0.15); animation: wobble 2s infinite; }
.drunk-overlay.level-4 { background: rgba(255, 50, 50, 0.2); animation: wobble 1s infinite; }
.drunk-overlay.level-5 { background: rgba(255, 0, 0, 0.25); animation: wobble 0.5s infinite; }

@keyframes wobble {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-3px) rotate(-0.5deg); }
  75% { transform: translateX(3px) rotate(0.5deg); }
}

#back-link {
  position: fixed;
  top: 10px;
  left: 10px;
  color: var(--dim);
  text-decoration: none;
  font-size: 0.7rem;
  z-index: 60;
}

#back-link:hover {
  color: var(--text);
}

#jukebox-panel {
  flex-shrink: 0;
}

#now-playing {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 6px 8px;
  background: rgba(200, 140, 20, 0.12);
  border: 1px solid #6a5018;
  border-radius: 3px;
  font-size: 0.45rem;
}

.now-playing-label {
  color: var(--gold);
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.5);
}

#current-track {
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#current-track.playing {
  animation: musicPulse 0.5s ease-in-out infinite;
  color: var(--gold);
}

@keyframes musicPulse {
  0%, 100% { opacity: 0.6; text-shadow: 0 0 4px rgba(255, 215, 0, 0.3); }
  50% { opacity: 1; text-shadow: 0 0 8px rgba(255, 215, 0, 0.8); }
}

#jukebox-select {
  width: 100%;
  padding: 8px;
  background: #150e04;
  border: 1px solid #3a2a14;
  color: var(--text);
  font-family: inherit;
  font-size: 0.45rem;
  border-radius: 3px;
  cursor: pointer;
  outline: none;
}

#jukebox-select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(255, 200, 50, 0.3);
}

#jukebox-select option {
  background: var(--bg);
  color: var(--text);
  font-size: 0.5rem;
}

#jukebox-select optgroup {
  background: var(--panel);
  color: var(--gold);
  font-style: normal;
  font-size: 0.5rem;
}

#jukebox-download-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.jukebox-dl-btn {
  flex: 1;
  background: rgba(200, 120, 40, 0.1);
  border-color: var(--amber);
  color: var(--amber);
  font-size: 0.38rem;
  padding: 5px 3px;
}

.jukebox-dl-btn:hover:not(:disabled) {
  background: rgba(200, 120, 40, 0.25);
}

.jukebox-dl-btn.rendering {
  opacity: 0.7;
  cursor: wait;
}

.drink-row {
  align-items: stretch;
}

.drink-select {
  flex: 1;
  background: #150e04;
  border: 1px solid #3a2a14;
  color: var(--text);
  font-family: inherit;
  font-size: 0.38rem;
  padding: 4px;
  border-radius: 3px;
  cursor: pointer;
  outline: none;
  min-width: 0;
}

.drink-select:focus {
  border-color: var(--amber);
}

.drink-select option {
  background: var(--bg);
  font-size: 0.5rem;
}

.chat-target-bar {
  font-size: 0.38rem;
  color: var(--pink);
  padding: 3px 8px;
  background: rgba(200, 100, 40, 0.1);
  border: 1px solid rgba(200, 100, 40, 0.3);
  border-radius: 2px;
  margin-bottom: 4px;
}

.chat-target-bar.hidden {
  display: none;
}

.chat-msg.npc {
  color: #c8b07a;
}

.chat-msg.npc .sender {
  color: #d4a060;
  font-weight: bold;
}

/* Collapsible profile panel */
.panel-header-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.panel-header-toggle:hover {
  color: #ffe566;
}

.collapse-indicator {
  font-size: 0.5rem;
  transition: transform 0.2s ease;
  display: inline-block;
}

#profile-panel.collapsed .collapse-indicator {
  transform: rotate(-90deg);
}

#profile-content {
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  max-height: 600px;
  opacity: 1;
}

#profile-panel.collapsed #profile-content {
  max-height: 0;
  opacity: 0;
}

/* View Profile button */
.action-btn.profile-btn {
  background: rgba(80, 200, 240, 0.1);
  border-color: #50c8f0;
  color: #50c8f0;
}

.action-btn.profile-btn:hover:not(:disabled) {
  background: rgba(80, 200, 240, 0.25);
}

/* Profile view modal */
#profile-view-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

#profile-view-modal.visible {
  display: flex;
}

.profile-view-box {
  min-width: 280px;
  max-width: 380px;
}

.profile-view-box h2 {
  color: #50c8f0;
  text-shadow: 0 0 10px rgba(80, 200, 240, 0.6);
  border-color: #50c8f0;
}

.pv-stat {
  font-size: 0.45rem;
  color: var(--dim);
  margin: 5px 0;
  line-height: 1.6;
  text-align: left;
}

.pv-stat span {
  color: var(--text);
}

.pv-lore {
  font-size: 0.42rem;
  color: #b89860;
  font-style: italic;
  margin: 8px 0;
  line-height: 1.7;
  text-align: left;
}

.pv-status {
  margin-top: 8px;
  padding: 6px 8px;
  font-size: 0.42rem;
  line-height: 1.6;
  background: rgba(180, 100, 30, 0.1);
  border: 1px solid #6a4820;
  border-radius: 3px;
  text-align: left;
}

.pv-status.married {
  background: rgba(255, 107, 157, 0.12);
  border-color: var(--pink);
}

.pv-npc-role {
  font-size: 0.45rem;
  color: var(--gold);
  margin-bottom: 8px;
  text-align: left;
}

.pv-interests {
  font-size: 0.42rem;
  color: var(--dim);
  margin: 5px 0;
  line-height: 1.6;
  text-align: left;
}

.pv-interests span {
  color: #b0e0a0;
}

#ad-panel {
  flex-shrink: 0;
}

#ad-panel .panel-header {
  color: var(--dim);
  font-size: 0.38rem;
}

#meetmarket-ad-slot .kuro-ad-label {
  color: #4a3820;
}

#meetmarket-ad-slot .kuro-ad-slogan {
  color: var(--text) !important;
}

#meetmarket-ad-slot .kuro-ad-visual {
  color: var(--dim) !important;
}

#meetmarket-ad-slot .kuro-ad-cat {
  font-size: 0.42rem;
}
