/* ============================================================
   ROLLO SIMULATOR — main.css
   Vue top-down + sous-scènes plein-écran.
   Tout en flat color CSS. Les images viendront après.
   ============================================================ */

:root {
  --bg: #0a0a0f;
  --bg-2: #12121b;
  --panel: #181826;
  --panel-2: #1f1f30;
  --line: #2a2a40;
  --text: #e8e8f0;
  --text-dim: #8b8ba8;
  --text-faint: #5a5a78;
  --accent: #b388ff;
  --accent-2: #00e5ff;
  --accent-3: #ff3d8a;
  --accent-4: #b6ff00;
  --warn: #ffb84d;
  --bad: #ff4d6d;
  --good: #5ddcff;
  --money: #b6ff00;

  /* Couleurs de l'appartement */
  --floor-1: #3a2820;
  --floor-2: #2e1f18;
  --wall: #1a1410;
  --wood: #5a3a28;
  --metal: #3a3a48;
  --bed-fabric: #2a3a5e;

  --shadow-rgb: 0 0 24px rgba(179,136,255,.25), 0 0 40px rgba(0,229,255,.12);
  --font-ui: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-display: "Impact", "Oswald", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(circle at 50% 0%, #1a1030 0%, var(--bg) 60%);
  color: var(--text);
  font-family: var(--font-ui);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ========== Strip RGB ========== */
#rgb-strip {
  height: 4px;
  background: linear-gradient(90deg, #ff3d8a 0%, #b388ff 25%, #00e5ff 50%, #b6ff00 75%, #ff3d8a 100%);
  background-size: 200% 100%;
  animation: rgbFlow 8s linear infinite;
  filter: blur(.3px) brightness(.85);
  opacity: .85;
}
@keyframes rgbFlow { 0%{background-position:0 0} 100%{background-position:200% 0} }

/* ========== Topbar ========== */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1.5rem;
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--font-display); letter-spacing: 1px; }
.brand .logo { color: var(--accent); text-shadow: 0 0 12px var(--accent); font-size: 1.4rem; }
.brand .logo-alt { color: var(--accent-2); text-shadow: 0 0 12px var(--accent-2); font-size: 1.4rem; }
.topbar-info { display: flex; gap: 1rem; font-size: .9rem; }
.topbar-info span { padding: .3rem .7rem; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
#money-label { color: var(--money); font-weight: bold; text-shadow: 0 0 8px rgba(182,255,0,.4); }
.topbar-actions button {
  background: var(--panel); color: var(--text-dim);
  border: 1px solid var(--line); padding: .4rem .8rem; border-radius: 6px;
  cursor: pointer; font-family: inherit;
}
.topbar-actions button:hover { color: var(--bad); border-color: var(--bad); }

/* ========== HUD jauges flottant (toujours visible) ========== */
#needs-hud {
  position: fixed;
  top: 70px;
  right: 16px;
  width: 220px;
  background: rgba(24, 24, 38, .9);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .7rem .9rem;
  z-index: 30;
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-rgb);
}
.gauge {
  display: grid;
  grid-template-columns: 60px 1fr 30px;
  align-items: center;
  gap: .4rem;
  margin-bottom: .4rem;
  font-size: .78rem;
}
.gauge label { color: var(--text-dim); }
.gauge .bar {
  height: 8px;
  background: var(--bg-2);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.gauge .fill {
  height: 100%; width: 100%;
  transition: width .25s ease, background .25s ease;
}
.gauge[data-need="hunger"]   .fill { background: linear-gradient(90deg, #ffb84d, #ff7e3d); }
.gauge[data-need="thirst"]   .fill { background: linear-gradient(90deg, #5ddcff, #00e5ff); }
.gauge[data-need="fatigue"]  .fill { background: linear-gradient(90deg, #b388ff, #6a3dff); }
.gauge[data-need="nicotine"] .fill { background: linear-gradient(90deg, #b6ff00, #6dff8a); }
.gauge.low .fill { animation: warnBlink 1s ease-in-out infinite; }
@keyframes warnBlink { 0%,100%{filter:brightness(1)} 50%{filter:brightness(.4)} }
.gauge .val { text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.needs-status {
  margin-top: .4rem;
  padding: .3rem .5rem;
  background: var(--bg-2);
  border-radius: 5px;
  font-size: .72rem;
  color: var(--text-dim);
  text-align: center;
}
.needs-status.bad { color: var(--bad); }

/* ========== Stage + scenes ========== */
#stage {
  position: relative;
  max-width: 1400px;
  margin: 1rem auto;
  padding: 0 1rem 2rem;
  min-height: calc(100vh - 80px);
}
.scene {
  display: none;
  animation: fadeIn .25s ease;
}
.scene[data-active="true"] { display: block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(6px);} to{opacity:1;transform:none;} }

.btn-back {
  background: var(--panel);
  color: var(--text-dim);
  border: 1px solid var(--line);
  padding: .5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 1rem;
  font-size: .9rem;
}
.btn-back:hover { color: var(--accent-2); border-color: var(--accent-2); }

/* ========== Scène : APPARTEMENT ========== */
#apartment {
  position: relative;
  width: 100%;
  height: 600px;
  max-width: 900px;
  margin: 0 auto;
  background-image: url("../img/appart/level0/level0.png");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  /* le pixel-art doit rester net en agrandissement */
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 0 24px rgba(179,136,255,.18);
}

/* Lumière du PC qui éclaire un peu le sol (par-dessus l'image) */
#apartment::after {
  content: "";
  position: absolute;
  left: 30px; top: 100px;
  width: 220px; height: 130px;
  background: radial-gradient(ellipse at center top, rgba(179,136,255,.22), transparent 70%);
  pointer-events: none;
  z-index: 1;
}

/* Mobilier — fond = image PNG, sans bordure, contenu décoratif uniquement */
.furniture {
  position: absolute;
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: contain;
  cursor: default;
  user-select: none;
  /* le label "SETUP PC / CUISINE / LIT" est masqué visuellement
     mais garde l'accessibilité ; il réapparaît si le sprite est cassé */
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 2px;
  /* le pixel-art / illustrations doivent rester nettes */
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  z-index: 2;
}
.furn-label {
  font-size: 0;
  /* on garde le label dans le DOM mais invisible — le visuel vient de l'image */
}

/* Sprites de meubles */
#furn-pc      { background-image: url("../img/appart/level0/ordinateurlevel0.png"); }
#furn-kitchen { background-image: url("../img/appart/level0/cuisinelevel0.png"); }
#furn-bed     { background-image: url("../img/appart/level0/litlevel0.png"); }

/* Surbrillance quand on est en proximité */
.furniture.nearby {
  filter: drop-shadow(0 0 8px rgba(179,136,255,.9))
          drop-shadow(0 0 16px rgba(179,136,255,.5));
  animation: furnPulseImg 1.2s ease-in-out infinite alternate;
}
@keyframes furnPulseImg {
  from { filter: drop-shadow(0 0 6px rgba(179,136,255,.6)) drop-shadow(0 0 12px rgba(179,136,255,.3)); }
  to   { filter: drop-shadow(0 0 12px rgba(179,136,255,1)) drop-shadow(0 0 24px rgba(179,136,255,.7)); }
}

/* (l'effet .furniture.nearby est défini juste au-dessus avec drop-shadow) */

/* Décorations non-interactives */
.deco-rug {
  position: absolute;
  left: 50%; top: 220px;
  transform: translateX(-50%);
  width: 280px; height: 140px;
  background:
    repeating-linear-gradient(45deg, rgba(255,61,138,.18) 0 8px, rgba(0,229,255,.18) 8px 16px),
    #2a1828;
  border-radius: 6px;
  opacity: .7;
  pointer-events: none;
}
.deco-trash {
  position: absolute;
  width: 14px; height: 14px;
  background: #4a3e2a;
  border-radius: 2px;
  opacity: .65;
  transform: rotate(20deg);
  pointer-events: none;
}
.deco-trash::after {
  content: "";
  position: absolute;
  inset: 2px;
  background: #6a5e3a;
  border-radius: 1px;
}

/* ========== Personnage ========== */
#player {
  position: absolute;
  left: 0; top: 0;
  width: 56px; height: 80px;     /* taille d'affichage du sprite */
  pointer-events: none;
  will-change: transform;
  z-index: 5;
}
.player-shadow {
  position: absolute;
  bottom: -2px; left: 50%;
  transform: translateX(-50%);
  width: 38px; height: 8px;
  background: rgba(0,0,0,.55);
  border-radius: 50%;
  filter: blur(3px);
  z-index: 0;
}
#player-sprite {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* le pixel-art doit rester net */
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  user-select: none;
  -webkit-user-drag: none;
  z-index: 1;
}

/* ========== Prompt d'interaction ========== */
#interact-prompt {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15,15,25,.92);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: .4rem .8rem;
  font-size: .85rem;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 0 16px rgba(179,136,255,.4);
  animation: promptFloat 1.6s ease-in-out infinite alternate;
  white-space: nowrap;
}
#interact-prompt.hidden { display: none; }
@keyframes promptFloat {
  from { transform: translate(-50%, calc(-50% - 2px)); }
  to   { transform: translate(-50%, calc(-50% + 2px)); }
}
.prompt-text { color: var(--text); }

.kbd {
  display: inline-block;
  padding: 1px .4rem;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 3px;
  font-size: .75em;
  color: var(--accent);
  font-weight: bold;
}

#controls-help {
  position: absolute;
  left: 12px; bottom: 12px;
  font-size: .75rem;
  color: var(--text-faint);
  background: rgba(0,0,0,.5);
  padding: .3rem .6rem;
  border-radius: 4px;
  z-index: 4;
  pointer-events: none;
}

/* ========== Scène : ORDINATEUR (stream) ========== */
.computer-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: var(--shadow-rgb);
}
.panel h3 {
  margin: 0 0 .7rem;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
}
.panel h3 .hint { color: var(--text-faint); font-weight: normal; text-transform: none; letter-spacing: 0; }

.screen {
  background: var(--bg-2);
  border: 2px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 500px;
}
.screen-header {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .8rem;
  background: #0d0d18;
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); display: inline-block; }
.dot.live { background: var(--bad); box-shadow: 0 0 8px var(--bad); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.stream-title { flex: 1; font-weight: bold; color: var(--text); }
.viewers { color: var(--text-dim); font-size: .85rem; }

.screen-body {
  display: grid;
  grid-template-columns: 1fr 220px;
  flex: 1;
  min-height: 320px;
}

.stream-feed {
  position: relative;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.02) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 30% 40%, rgba(0,229,255,.08), transparent 60%),
    radial-gradient(circle at 70% 60%, rgba(255,61,138,.08), transparent 60%),
    #050510;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.feed-placeholder { color: var(--text-faint); font-style: italic; }

.feed-event {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  font-size: 1.05rem;
  padding: 1rem;
}
.feed-event .label {
  display: inline-block;
  padding: .3rem .8rem;
  background: rgba(0,0,0,.6);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}

.clip-prompt {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  padding: .8rem 1.6rem;
  background: linear-gradient(135deg, var(--accent-3), var(--accent));
  color: white;
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 2px;
  border-radius: 8px;
  box-shadow: 0 0 30px var(--accent-3);
  pointer-events: none;
  animation: clipPulse .35s ease-in-out infinite alternate;
}
@keyframes clipPulse {
  0% { transform: translate(-50%,-50%) scale(.95); }
  100% { transform: translate(-50%,-50%) scale(1.08); }
}

.chat {
  background: #0a0a14;
  border-left: 1px solid var(--line);
  font-size: .8rem;
  padding: .4rem .5rem;
  overflow: hidden;
  display: flex; flex-direction: column-reverse;
  gap: .15rem;
}
.chat-msg {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  animation: chatIn .25s ease-out;
}
.chat-msg .user { font-weight: bold; }
@keyframes chatIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.screen-footer {
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem .8rem;
  background: #0d0d18;
  border-top: 1px solid var(--line);
}
.btn-clip {
  font-family: var(--font-display);
  font-size: 1.2rem; letter-spacing: 2px;
  padding: .5rem 1.2rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: white; border: none; border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(179,136,255,.4);
  transition: transform .08s, box-shadow .2s;
}
.btn-clip:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 0 24px rgba(255,61,138,.6); }
.btn-clip:active:not(:disabled) { transform: translateY(1px); }
.btn-clip:disabled { background: var(--panel-2); color: var(--text-faint); cursor: not-allowed; box-shadow: none; }
.btn-clip .kbd { color: white; }
.clip-feedback { font-size: .9rem; color: var(--text-dim); flex: 1; }
.clip-feedback.good { color: var(--accent-4); }
.clip-feedback.bad  { color: var(--bad); }

.computer-side h3 { margin-top: 0; }

/* ========== Scène : CUISINE ========== */
.kitchen-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.shop-grid, .inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .5rem;
}
.shop-item, .inv-item {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .6rem;
  cursor: pointer;
  transition: border-color .15s, transform .08s;
  font-size: .8rem;
  position: relative;
}
.shop-item:hover, .inv-item:hover { border-color: var(--accent); }
.shop-item:active, .inv-item:active { transform: translateY(1px); }
.shop-item.disabled { opacity: .5; cursor: not-allowed; }
.shop-item .name, .inv-item .name { font-weight: bold; color: var(--text); }
.shop-item .desc, .inv-item .desc { color: var(--text-faint); font-size: .75rem; margin: .2rem 0; }
.shop-item .price { color: var(--money); font-weight: bold; }
.shop-item.owned { opacity: .6; border-color: var(--accent-4); }
.shop-item.owned::after {
  content: "ACQUIS";
  position: absolute; top: 4px; right: 4px;
  font-size: .65rem; color: var(--accent-4);
}
.inv-item .qty {
  position: absolute; top: 4px; right: 6px;
  background: var(--accent); color: white;
  font-size: .7rem; padding: 0 .3rem; border-radius: 3px;
  font-weight: bold;
}
.inv-item.empty {
  border-style: dashed;
  text-align: center;
  color: var(--text-faint);
  cursor: default;
}

/* Factures */
#bills-list { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
#bills-list li {
  display: flex; justify-content: space-between;
  padding: .3rem 0;
  border-bottom: 1px dashed var(--line);
  color: var(--text-dim);
}
#bills-list li .amount { color: var(--bad); }
#bills-summary {
  margin-top: .6rem;
  padding: .5rem;
  background: var(--bg-2);
  border-radius: 4px;
  text-align: center;
  font-size: .85rem;
}
#bills-summary .total { color: var(--bad); font-weight: bold; }

/* ========== Scène : LIT ========== */
.bed-panel {
  max-width: 540px;
  margin: 4rem auto;
  text-align: center;
}
.bed-panel h2 {
  font-family: var(--font-display);
  letter-spacing: 2px;
  color: var(--accent);
  text-shadow: 0 0 14px var(--accent);
}
.bed-info { color: var(--text-dim); line-height: 1.5; }
.bed-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}
.bed-option {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  display: flex; flex-direction: column; gap: .3rem;
  text-align: center;
  transition: border-color .15s, transform .08s;
}
.bed-option:hover { border-color: var(--accent); transform: translateY(-1px); }
.bed-option strong { color: var(--accent-2); font-size: 1rem; }
.bed-option span { color: var(--text-dim); font-size: .85rem; }

/* ========== Modal + toasts ========== */
#modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
#modal-overlay.hidden { display: none; }
#modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.5rem 2rem;
  max-width: 480px;
  text-align: center;
  box-shadow: 0 0 50px rgba(179,136,255,.4);
}
#modal h2 {
  font-family: var(--font-display); letter-spacing: 2px;
  color: var(--accent); text-shadow: 0 0 14px var(--accent);
  margin: 0 0 1rem;
}
#modal-body { color: var(--text-dim); margin-bottom: 1.2rem; line-height: 1.5; }
#modal-body strong { color: var(--text); }
#modal-action {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: white; border: none;
  padding: .6rem 1.4rem;
  border-radius: 6px;
  font-family: var(--font-display);
  letter-spacing: 1px;
  cursor: pointer;
  font-size: 1rem;
}
#modal-action:hover { box-shadow: 0 0 20px var(--accent-3); }

#toasts {
  position: fixed; bottom: 1rem; right: 1rem;
  display: flex; flex-direction: column; gap: .5rem;
  z-index: 50;
  pointer-events: none;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--accent);
  border-left-width: 4px;
  border-radius: 6px;
  padding: .6rem 1rem;
  font-size: .9rem;
  min-width: 200px;
  animation: toastIn .2s ease-out, toastOut .25s ease-in 2.7s forwards;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.toast.good  { border-color: var(--accent-4); color: var(--accent-4); }
.toast.bad   { border-color: var(--bad); color: var(--bad); }
.toast.money { border-color: var(--money); color: var(--money); }
@keyframes toastIn { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateX(120%); opacity: 0; } }

/* ========== Responsive ========== */
@media (max-width: 980px) {
  #needs-hud { position: static; width: auto; margin: .5rem 1rem; }
  .computer-grid { grid-template-columns: 1fr; }
  .kitchen-grid { grid-template-columns: 1fr; }
  .screen-body { grid-template-columns: 1fr; }
  .chat { display: none; }
  #apartment { height: 480px; }
  .bed-options { grid-template-columns: 1fr; }
}
