:root {
  --bg: #020711;
  --panel: rgba(8, 16, 30, 0.76);
  --panel-strong: rgba(8, 16, 30, 0.96);
  --border: rgba(92, 210, 255, 0.34);
  --border-strong: rgba(92, 210, 255, 0.62);
  --text: #e9fbff;
  --text2: #b6e6ff;
  --text3: #7fb8d6;
  --blue: #4ad8ff;
  --green: #72ffa8;
  --amber: #ffc95b;
  --pink: #ff63cf;
  --danger: #ff6b84;
  --shadow: rgba(0, 0, 0, 0.58);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", Consolas, monospace;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

#app {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}

#city-scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 74% 18%, rgba(122, 75, 182, 0.24), transparent 24%),
    linear-gradient(180deg, #020711 0%, #06101f 46%, #070810 100%);
  transition: background 0.6s ease;
  z-index: -5;
}

.sky-gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 42% 22%, rgba(74, 216, 255, 0.16), transparent 28%),
    radial-gradient(circle at 88% 40%, rgba(255, 99, 207, 0.12), transparent 26%);
}

.city-aurora {
  position: absolute;
  inset: -20% -10% auto;
  height: 54vh;
  background:
    linear-gradient(90deg, transparent, rgba(74, 216, 255, 0.12), transparent),
    linear-gradient(120deg, transparent 20%, rgba(255, 99, 207, 0.09), transparent 70%);
  filter: blur(28px);
  opacity: 0.8;
}

.moon {
  position: absolute;
  top: 66px;
  right: 12vw;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffef2, #cdeaff 72%);
  box-shadow: 0 0 52px rgba(205, 234, 255, 0.72);
  transition: opacity 0.4s ease;
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #e8fbff;
  opacity: 0.7;
  animation: twinkle 2.5s ease-in-out infinite alternate;
}

.skyline-layer {
  position: absolute;
  left: -2vw;
  right: -2vw;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 10px;
  pointer-events: none;
}

.skyline-far {
  bottom: 30vh;
  opacity: 0.34;
  filter: blur(0.4px);
}

.skyline-mid {
  bottom: 20vh;
  opacity: 0.64;
}

.skyline-front {
  bottom: 10vh;
  opacity: 0.96;
}

.building {
  position: relative;
  width: var(--building-width);
  height: var(--building-height);
  min-width: 32px;
  flex: 0 0 var(--building-width);
  border: 1px solid rgba(86, 188, 230, 0.2);
  border-bottom: 0;
  background:
    linear-gradient(180deg, rgba(22, 40, 70, 0.96), rgba(5, 12, 23, 0.98)),
    repeating-linear-gradient(90deg, transparent 0 10px, rgba(255, 217, 117, 0.2) 10px 16px);
  box-shadow: inset 0 0 24px rgba(74, 216, 255, 0.06), 0 -10px 36px rgba(74, 216, 255, 0.05);
}

.building::before {
  content: "";
  position: absolute;
  inset: 14px 10px;
  background-image:
    linear-gradient(90deg, rgba(255, 210, 95, 0.6) 7px, transparent 7px),
    linear-gradient(rgba(255, 210, 95, 0.55) 5px, transparent 5px);
  background-position: var(--window-offset) 0;
  background-size: 18px 23px;
  opacity: 0.42;
}

.building::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 2px;
  background: rgba(74, 216, 255, 0.52);
  box-shadow: 0 0 12px rgba(74, 216, 255, 0.5);
}

.building.spire {
  clip-path: polygon(50% 0, 100% 11%, 100% 100%, 0 100%, 0 11%);
}

.building.wide {
  flex-grow: 0.35;
}

.rain-container,
.rain-visual {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

.rain-drop,
.raindrop {
  position: absolute;
  top: -16vh;
  width: 1px;
  height: 54px;
  background: linear-gradient(180deg, transparent, rgba(128, 226, 255, 0.82));
  animation: rain-fall linear infinite;
}

.raindrop {
  height: 18px;
  opacity: 0.72;
}

.puddle {
  position: absolute;
  bottom: 12vh;
  width: 90px;
  height: 12px;
  border-radius: 50%;
  background: rgba(74, 216, 255, 0.12);
  filter: blur(1px);
}

.neon-sign {
  position: absolute;
  bottom: 48vh;
  color: var(--pink);
  font-family: "Syne", sans-serif;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-shadow: 0 0 12px currentColor, 0 0 28px currentColor;
}

.street-glow {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22vh;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(74, 216, 255, 0.16), transparent 48%),
    linear-gradient(180deg, rgba(4, 8, 14, 0), rgba(1, 3, 8, 0.92));
}

#scanlines,
#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#scanlines {
  z-index: 20;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 4px);
  mix-blend-mode: overlay;
}

#vignette {
  z-index: 21;
  box-shadow: inset 0 0 170px rgba(0, 0, 0, 0.84);
}

.sound-pill {
  position: fixed;
  top: 22px;
  left: 50%;
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 7px 9px 7px 14px;
  transform: translateX(-50%);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(5, 13, 24, 0.72);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28), 0 0 24px rgba(74, 216, 255, 0.08);
  backdrop-filter: blur(14px);
}

.sound-pill-label {
  color: var(--text2);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#toggle-sound {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 76px;
  justify-content: center;
  border: 1px solid rgba(74, 216, 255, 0.38);
  border-radius: 999px;
  color: var(--text);
  background: rgba(74, 216, 255, 0.1);
  padding: 7px 11px;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

#toggle-sound.active {
  color: #03131c;
  border-color: transparent;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

#sound-status {
  min-width: 74px;
  color: var(--text3);
  font-size: 0.72rem;
}

#quick-actions {
  position: fixed;
  top: 630px;
  right: 24px;
  z-index: 35;
  display: flex;
  gap: 10px;
}

#clock,
#visitor-badge {
  position: fixed;
  top: 26px;
  z-index: 35;
  color: var(--green);
  text-shadow: 0 0 12px currentColor;
  font-size: 0.86rem;
}

#clock {
  left: 24px;
}

#visitor-badge {
  right: 24px;
}

#desk {
  position: relative;
  width: min(1180px, calc(100vw - 42px));
  min-height: 650px;
  margin: 0 auto;
  padding-top: 180px;
  z-index: 5;
}

.desk-surface {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: min(1080px, 92vw);
  height: 235px;
  transform: translateX(-50%) perspective(780px) rotateX(60deg);
  transform-origin: bottom;
  border-radius: 34px 34px 12px 12px;
  background:
    linear-gradient(135deg, rgba(82, 44, 25, 0.88), rgba(42, 22, 13, 0.95)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 30px);
  box-shadow: 0 -8px 50px rgba(255, 112, 54, 0.08), 0 42px 88px rgba(0, 0, 0, 0.72);
}

.desk-grain {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-linear-gradient(92deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.035) 2px, transparent 2px, transparent 18px);
  opacity: 0.65;
}

.desk-object {
  position: absolute;
  width: 230px;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(14, 25, 43, 0.88), rgba(6, 12, 24, 0.9));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.43), inset 0 0 20px rgba(74, 216, 255, 0.04);
  backdrop-filter: blur(12px);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.desk-object:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
}

.desk-object.dragging {
  cursor: grabbing;
  transform: none !important;
  border-color: var(--green);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.62), 0 0 26px rgba(114, 255, 168, 0.18);
}

.desk-object button,
.desk-object a {
  user-select: auto;
}

.obj-terminal {
  left: 4%;
  top: 252px;
}

.obj-about {
  left: 28%;
  top: 190px;
}

.obj-skills {
  right: 25%;
  top: 286px;
  width: 250px;
}

.obj-contact {
  right: 4%;
  top: 206px;
  width: 246px;
}

.obj-projects {
  left: 46%;
  top: 430px;
}

.obj-header,
.term-header,
.about-modal-header {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.045);
  border-bottom: 1px solid rgba(74, 216, 255, 0.18);
}

.obj-header {
  cursor: grab;
}

.dragging .obj-header {
  cursor: grabbing;
}

.obj-dot {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border: 0;
  border-radius: 50%;
}

.red {
  background: #ff5f57;
}

.yellow {
  background: #ffbd2e;
}

.green {
  background: #28c840;
}

.modal-dot-btn {
  padding: 0;
}

.obj-title,
.term-title {
  min-width: 0;
  overflow: hidden;
  color: var(--text2);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.term-title {
  flex: 1;
}

.obj-body {
  flex: 1;
  padding: 14px;
  color: var(--text3);
  font-size: 0.78rem;
  line-height: 1.55;
}

.terminal-preview div:first-child {
  margin-bottom: 5px;
  color: var(--blue);
}

.obj-open-btn,
.ctrl-btn,
.contact-send,
.term-close,
#close-game,
#exit-game {
  border: 1px solid rgba(74, 216, 255, 0.38);
  border-radius: 999px;
  color: var(--text);
  background: rgba(74, 216, 255, 0.11);
  padding: 10px 16px;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.obj-open-btn {
  width: 100%;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  color: var(--blue);
  background: rgba(74, 216, 255, 0.13);
}

.obj-open-btn:hover,
.ctrl-btn:hover,
.contact-send:hover,
.term-close:hover,
#toggle-sound:hover,
#close-game:hover,
#exit-game:hover {
  transform: translateY(-1px);
  background: rgba(74, 216, 255, 0.23);
  border-color: rgba(74, 216, 255, 0.78);
}

.ctrl-btn.active {
  color: #03131c;
  border-color: transparent;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.quick-action-btn {
  padding: 9px 13px;
  font-size: 0.78rem;
  backdrop-filter: blur(12px);
}

.about-card-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.about-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #03131c;
  background: linear-gradient(135deg, var(--blue), var(--green));
  font-family: "Syne", sans-serif;
  font-weight: 800;
}

.about-name {
  color: var(--text);
  font-weight: 700;
}

.about-role,
.about-short,
.skill-label {
  color: var(--text3);
  font-size: 0.72rem;
}

.skill-label {
  margin: 2px 0 7px;
  letter-spacing: 0.14em;
}

.skill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.skill-tag {
  display: inline-flex;
  border: 1px solid rgba(114, 255, 168, 0.28);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--green);
  background: rgba(114, 255, 168, 0.08);
  font-size: 0.72rem;
}

.contact-header {
  border-bottom-color: rgba(114, 255, 168, 0.25);
  background: rgba(8, 45, 24, 0.34);
}

.contact-header .obj-title {
  color: #a5ff8f;
}

.contact-note {
  padding: 12px;
}

.sticky-line {
  margin-bottom: 10px;
  word-break: break-word;
}

.sticky-line a {
  color: #c9ffbb;
  font-size: 0.68rem;
}

.contact-open-btn {
  color: #9bea72;
  background: rgba(0, 100, 30, 0.15);
  border-top-color: rgba(114, 255, 168, 0.24);
}

.proj-item {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  color: var(--text2);
}

.proj-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 10px var(--pink);
}

#controls {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 35;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: min(560px, calc(100vw - 24px));
  transform: translateX(-50%);
}

.ctrl-btn {
  font-size: 0.78rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(1, 6, 12, 0.68);
  backdrop-filter: blur(10px);
}

.modal.is-open {
  display: flex;
}

.terminal-window,
.about-window,
.contact-window {
  width: min(760px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 48px rgba(74, 216, 255, 0.14);
}

.terminal-window {
  display: flex;
  min-height: 460px;
  flex-direction: column;
}

.term-close {
  border-radius: 10px;
  padding: 4px 8px;
  color: var(--danger);
  background: rgba(255, 107, 132, 0.09);
  border-color: rgba(255, 107, 132, 0.28);
}

.term-output {
  flex: 1;
  min-height: 300px;
  overflow-y: auto;
  padding: 18px;
  color: var(--text2);
  line-height: 1.55;
  white-space: pre-wrap;
}

.term-line {
  margin-bottom: 7px;
}

.term-command {
  color: var(--green);
}

.term-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(74, 216, 255, 0.18);
  padding: 12px 16px;
}

.term-prompt {
  color: var(--green);
  white-space: nowrap;
}

.term-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.about-modal-body,
.contact-body {
  padding: 24px;
}

.about-big-name {
  color: var(--text);
  font-family: "Syne", sans-serif;
  font-size: clamp(2rem, 7vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.about-big-role {
  margin: 8px 0 18px;
  color: var(--blue);
  letter-spacing: 0.12em;
  font-size: 0.8rem;
}

.about-bio {
  color: var(--text2);
  line-height: 1.7;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.social-link {
  border: 1px solid rgba(74, 216, 255, 0.3);
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--text);
  text-decoration: none;
  background: rgba(74, 216, 255, 0.1);
}

.contact-body {
  display: grid;
  gap: 16px;
}

.contact-label {
  display: block;
  margin-bottom: 7px;
  color: var(--text3);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
}

.contact-input,
.contact-textarea {
  width: 100%;
  border: 1px solid rgba(74, 216, 255, 0.24);
  border-radius: 12px;
  outline: 0;
  color: var(--text);
  background: rgba(0, 0, 0, 0.22);
  padding: 12px 14px;
}

.contact-textarea {
  min-height: 128px;
  resize: vertical;
}

.contact-status {
  min-height: 22px;
  color: var(--green);
}

.contact-status.error {
  color: var(--danger);
}

.tooltip {
  position: fixed;
  z-index: 90;
  display: none;
  max-width: 260px;
  border: 1px solid rgba(74, 216, 255, 0.3);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--text2);
  background: rgba(2, 8, 16, 0.9);
  pointer-events: none;
  font-size: 0.76rem;
}

#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  gap: 18px;
  background: #020711;
  color: var(--blue);
  text-align: center;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-ascii {
  margin: 0;
  color: var(--blue);
  font-size: clamp(0.5rem, 1.6vw, 0.95rem);
  text-shadow: 0 0 14px rgba(74, 216, 255, 0.7);
}

.loader-bar-outer {
  width: min(460px, 80vw);
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(74, 216, 255, 0.45);
  border-radius: 999px;
}

.loader-bar-inner {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 0.22s ease;
}

.loader-text {
  color: var(--text2);
  letter-spacing: 0.14em;
  font-size: 0.8rem;
}

body.crt-green {
  --blue: #72ffa8;
  --border: rgba(114, 255, 168, 0.34);
  --border-strong: rgba(114, 255, 168, 0.62);
}

body.crt-amber {
  --blue: #ffc95b;
  --green: #ffe6a7;
  --border: rgba(255, 201, 91, 0.38);
  --border-strong: rgba(255, 201, 91, 0.62);
}

body.rain-off .rain-container,
body.rain-off .rain-visual {
  display: none;
}

body.day {
  --bg: #dbeaff;
  --panel: rgba(246, 251, 255, 0.78);
  --panel-strong: rgba(246, 251, 255, 0.96);
  --text: #092135;
  --text2: #284b63;
  --text3: #476a80;
  --shadow: rgba(25, 63, 92, 0.23);
}

body.day #city-scene {
  background:
    radial-gradient(circle at 72% 20%, rgba(255, 245, 210, 0.5), transparent 20%),
    linear-gradient(180deg, #e8f2ff 0%, #b8d8f5 50%, #eef8ff 100%);
}

body.day #scanlines {
  opacity: 0.28;
}

body.day .moon,
body.day #stars-container,
body.day .city-aurora {
  opacity: 0;
}

.game-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, rgba(74, 216, 255, 0.18), transparent 28%), rgba(0, 0, 0, 0.82);
}

.game-panel {
  position: fixed;
  top: 26px;
  left: 50%;
  z-index: 2;
  width: min(420px, calc(100vw - 32px));
  padding: 18px;
  transform: translateX(-50%);
  border: 1px solid var(--border);
  border-radius: 18px;
  color: #fff;
  text-align: center;
  background: rgba(8, 16, 30, 0.88);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.game-panel h2 {
  margin: 0 0 6px;
  color: var(--blue);
  font-family: "Syne", sans-serif;
}

.game-panel p {
  margin: 0 0 14px;
  color: var(--text2);
  font-size: 0.82rem;
}

.game-score,
.game-over {
  color: #fff;
  font-size: 1.2rem;
  margin-bottom: 14px;
}

.game-drop {
  position: absolute;
  top: -44px;
  z-index: 101;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: radial-gradient(circle at 35% 25%, #e8fbff, #00c6ff 48%, #0072ff);
  box-shadow: 0 0 18px #00c6ffaa, 0 0 36px #0072ffaa;
  transition: top 3.5s linear;
  will-change: top;
  pointer-events: auto;
}

#exit-game,
#close-game {
  min-width: 120px;
  color: #03131c;
  background: linear-gradient(90deg, var(--blue), var(--green));
  border-color: transparent;
}

@keyframes rain-fall {
  to {
    transform: translate3d(-42px, 120vh, 0);
  }
}

@keyframes twinkle {
  to {
    opacity: 0.24;
    transform: scale(0.65);
  }
}

@media (max-width: 980px) {
  .sound-pill {
    top: 64px;
    left: 16px;
    transform: none;
  }

  #quick-actions {
    top: 118px;
    left: 16px;
    right: auto;
    flex-wrap: wrap;
  }

  #clock,
  #visitor-badge {
    top: 18px;
  }

  #desk {
    display: grid;
    gap: 18px;
    width: min(520px, calc(100vw - 28px));
    min-height: 0;
    padding: 190px 0 130px;
  }

  .desk-surface {
    display: none;
  }

  .desk-object {
    position: static;
    width: 100%;
  }
}

@media (max-width: 560px) {
  #clock,
  #visitor-badge {
    position: absolute;
    font-size: 0.72rem;
  }

  .sound-pill {
    width: calc(100vw - 32px);
    justify-content: space-between;
  }

  #controls {
    bottom: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
