:root {
  --scale: 1;
  --pink: #ff5fa2;
  --violet: #8a5cf6;
  --aqua: #3fd8d2;
  --lcd-bg: #9fb56a;
  --lcd-on: #1f2b12;
  --frame: #ff5fa2;
  --frame-glow: rgba(255, 95, 162, 0.35);
}

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
  font-family: "Roboto", "Segoe UI", sans-serif;
  color: #fff;
}

.stage {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: calc(12px * var(--scale));
  padding: calc(18px * var(--scale));
}

.rig {
  display: flex;
  align-items: center;
  gap: calc(16px * var(--scale));
}

.panel-below .rig { flex-direction: column; align-items: center; }
.panel-off .panel,
.panel-screen .panel { display: none; }

/* ---------- LCD palettes ---------- */
.lcd-green { --lcd-bg: #9fb56a; --lcd-on: #1f2b12; }
.lcd-grey { --lcd-bg: #c3c7b8; --lcd-on: #1c1e18; }
.lcd-color { --lcd-bg: #eef2e4; --lcd-on: #2b2140; }

/* ---------- border colours ---------- */
.shell-pink { --frame: #ff5fa2; --frame-glow: rgba(255, 95, 162, 0.35); }
.shell-blue { --frame: #3d9bff; --frame-glow: rgba(61, 155, 255, 0.35); }
.shell-yellow { --frame: #ffd23f; --frame-glow: rgba(255, 210, 63, 0.35); }
.shell-purple { --frame: #8a5cf6; --frame-glow: rgba(138, 92, 246, 0.4); }
.shell-aqua { --frame: #3fd8d2; --frame-glow: rgba(63, 216, 210, 0.35); }
.shell-orange { --frame: #ff8a2b; --frame-glow: rgba(255, 138, 43, 0.35); }
.shell-white { --frame: #f2f0f7; --frame-glow: rgba(255, 255, 255, 0.3); }
.shell-black { --frame: #4a4655; --frame-glow: rgba(0, 0, 0, 0.4); }
.shell-clear { --frame: rgba(255, 255, 255, 0.45); --frame-glow: rgba(255, 255, 255, 0.15); }

/* ---------- screen ---------- */
.device {
  position: relative;
  flex: 0 0 auto;
}

.screen-frame {
  position: relative;
  padding: calc(10px * var(--scale)) calc(14px * var(--scale));
  border-radius: calc(16px * var(--scale));
  border: calc(3px * var(--scale)) solid var(--frame);
  background: linear-gradient(160deg, #2c2433, #16121b);
  box-shadow:
    inset 0 calc(3px * var(--scale)) calc(8px * var(--scale)) rgba(0, 0, 0, 0.7),
    0 calc(10px * var(--scale)) calc(30px * var(--scale)) rgba(0, 0, 0, 0.45),
    0 0 calc(18px * var(--scale)) var(--frame-glow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(4px * var(--scale));
}

.theme-digimon .screen-frame { border-radius: calc(10px * var(--scale)); }

.screen-frame canvas {
  display: block;
  border-radius: calc(6px * var(--scale));
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.2);
  image-rendering: pixelated;
}

.icons {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: calc(4px * var(--scale)) calc(10px * var(--scale));
  box-sizing: border-box;
  background: var(--lcd-bg);
  border-radius: calc(6px * var(--scale));
}

.icons i {
  font-size: calc(17px * var(--scale));
  color: var(--lcd-on);
  opacity: 0.22;
  transition: opacity 0.12s ease;
}

.icons i.lit { opacity: 0.95; }

.panel-screen .icons.top i { font-size: calc(15px * var(--scale)); }

/* ---------- stats on the screen ---------- */
.icons.lcd-stats {
  display: block;
  color: var(--lcd-on);
  font-family: "Press Start 2P", monospace;
  font-size: calc(8px * var(--scale));
  line-height: 1.5;
  padding: calc(5px * var(--scale)) calc(8px * var(--scale));
}

.icons.lcd-stats i {
  font-size: calc(10px * var(--scale));
  opacity: 1;
  transition: none;
}

.ls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: calc(6px * var(--scale));
  white-space: nowrap;
}

.ls-item {
  display: inline-flex;
  align-items: center;
  gap: calc(3px * var(--scale));
  min-width: 0;
}

.ls-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ls-hearts i { margin-left: calc(1px * var(--scale)); }
.icons.lcd-stats .ls-hearts i.off { opacity: 0.22; }

.ls-bar {
  display: inline-block;
  width: calc(90px * var(--scale));
  height: calc(6px * var(--scale));
  border: 1px solid var(--lcd-on);
  border-radius: 2px;
}

.ls-bar b {
  display: block;
  height: 100%;
  background: var(--lcd-on);
}

/* ---------- panel ---------- */
.panel {
  min-width: calc(210px * var(--scale));
  max-width: calc(260px * var(--scale));
  padding: calc(12px * var(--scale)) calc(14px * var(--scale));
  border-radius: calc(16px * var(--scale));
  background: linear-gradient(145deg, rgba(24, 14, 30, 0.9), rgba(30, 16, 44, 0.88));
  border: calc(2px * var(--scale)) solid transparent;
  background-clip: padding-box;
  box-shadow: 0 0 0 calc(2px * var(--scale)) var(--frame), 0 calc(10px * var(--scale)) calc(30px * var(--scale)) rgba(0, 0, 0, 0.45);
  font-size: calc(13px * var(--scale));
}

.panel-name {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  font-size: calc(16px * var(--scale));
  background: linear-gradient(90deg, var(--pink), var(--aqua));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.panel-gen {
  font-size: calc(10px * var(--scale));
  -webkit-text-fill-color: #d9c7e6;
}

.panel-stage {
  color: #cdb6dc;
  font-size: calc(11px * var(--scale));
  margin: calc(2px * var(--scale)) 0 calc(8px * var(--scale));
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.prow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: calc(3px * var(--scale)) 0;
}

.prow span:first-child { color: #d9c7e6; }
.prow b { color: #fff; }

.hearts i {
  margin-left: calc(2px * var(--scale));
  color: var(--pink);
  font-size: calc(12px * var(--scale));
}

.theme-digimon .hearts .fa-dumbbell, .theme-digimon .hearts .fa-fire { color: var(--aqua); }
.hearts i.off { color: rgba(255, 255, 255, 0.2); }

.pbar {
  width: calc(96px * var(--scale));
  height: calc(8px * var(--scale));
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.pbar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--violet), var(--aqua));
}

.pflags {
  margin-top: calc(6px * var(--scale));
  color: #ffd166;
  font-weight: 700;
  font-size: calc(11px * var(--scale));
}

.panel-friend {
  margin-top: calc(6px * var(--scale));
  color: #ffb3d4;
  font-size: calc(11px * var(--scale));
}

.panel-friend:empty { display: none; }

/* ---------- banner ---------- */
.banner {
  align-self: stretch;
  padding: calc(8px * var(--scale)) calc(14px * var(--scale));
  border-radius: calc(14px * var(--scale));
  background: linear-gradient(90deg, rgba(255, 95, 162, 0.95), rgba(138, 92, 246, 0.95));
  box-shadow: 0 calc(6px * var(--scale)) calc(20px * var(--scale)) rgba(0, 0, 0, 0.35);
  min-height: calc(50px * var(--scale));
  box-sizing: border-box;
  transition: opacity 0.25s ease;
}

.banner[hidden] { display: block; visibility: hidden; opacity: 0; }

.banner-title {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  font-size: calc(14px * var(--scale));
}

.banner-sub {
  font-size: calc(13px * var(--scale));
  margin-top: 2px;
  color: #fff3fa;
}

.banner-bar {
  margin-top: calc(6px * var(--scale));
  height: calc(8px * var(--scale));
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.banner-bar[hidden] { visibility: hidden; }

.banner-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--aqua), #b5fff9);
  transition: width 0.3s ease;
}

/* ---------- feed ---------- */
/* width, left edge and top are set from the device in JS so the log sits flush under the screen */
.feed {
  box-sizing: border-box;
  padding: calc(6px * var(--scale)) calc(10px * var(--scale)) calc(14px * var(--scale));
  background: linear-gradient(180deg, rgba(22, 18, 27, 0.92), rgba(22, 18, 27, 0));
  border-top: calc(2px * var(--scale)) solid var(--frame);
  font-size: calc(12px * var(--scale));
  line-height: 1.3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
  mask-image: linear-gradient(180deg, #000 55%, transparent);
}

.feed:empty,
.no-feed .feed { display: none; }

.feed-line { overflow-wrap: anywhere; }

.sb-note {
  position: fixed;
  right: 12px;
  bottom: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #ffb3d4;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sb-note.show { opacity: 1; }