/* True Cyberpunk. Matte near black, hairline borders, monospace, restrained. */

:root {
  --bg: #0a0a0a;
  --bg-soft: #101010;
  --fg: #e8e8e8;
  --dim: #8a8a8a;
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.34);
  --hl: #ffffff;
  --ok: #7CF6C9;
  --bad: #ff6b6b;
  --tap: rgba(255, 255, 255, 0.06);
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --gap: 14px;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: local('JetBrains Mono'), local('JetBrainsMono-Regular');
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

body {
  display: flex;
  min-height: 100dvh;
}

/* Subtle scanline overlay, kept faint so it never fights the content. */
#scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.015) 0px,
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: screen;
  opacity: 0.5;
}

#app {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 100dvh;
  padding: 24px 0;
  animation: fade-in 0.32s ease both;
}

.screen.center {
  justify-content: center;
  align-items: stretch;
}

.screen[hidden] {
  display: none;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* leaving transition */
.screen.leaving {
  animation: glitch-out 0.22s steps(2, end) both;
}

@keyframes glitch-out {
  0% {
    opacity: 1;
    transform: translateX(0);
    filter: none;
  }
  40% {
    transform: translateX(-2px) skewX(-1deg);
    filter: brightness(1.4);
  }
  100% {
    opacity: 0;
    transform: translateX(3px);
  }
}

/* ---------- terminal / scan ---------- */
.terminal {
  margin: auto 0;
  font-size: 15px;
}

.terminal .line {
  margin: 0 0 10px;
  opacity: 0;
  color: var(--dim);
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal .line.show {
  opacity: 1;
  animation: type-in 0.28s ease both;
}

@keyframes type-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hl {
  color: var(--hl);
  font-weight: 600;
}

.blink {
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ---------- headers ---------- */
.head {
  margin-bottom: 22px;
}

.tag {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--dim);
  border: 1px solid var(--line);
  display: inline-block;
  padding: 4px 8px;
  margin-bottom: 16px;
}

.head h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.sub {
  color: var(--dim);
  font-size: 14px;
  margin: 0;
}

/* ---------- skills grid ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: 1;
  align-content: start;
}

.skill {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.3;
  text-align: left;
  padding: 14px 12px;
  min-height: 74px;
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.08s;
  position: relative;
}

.skill:active {
  transform: scale(0.98);
}

.skill.selected {
  border-color: var(--line-strong);
  background: #161616;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.skill.selected::after {
  content: '●';
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 10px;
  color: var(--ok);
}

.skill.disabled {
  opacity: 0.32;
  pointer-events: none;
}

/* ---------- pay ---------- */
.pay-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: auto 0;
}

.pay-card {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--fg);
  font-family: var(--mono);
  text-align: left;
  padding: 22px 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s, transform 0.08s, background 0.15s;
}

.pay-card:active {
  transform: scale(0.985);
}

.pay-card:hover {
  border-color: var(--line-strong);
}

.pay-title {
  font-size: 17px;
  font-weight: 600;
}

.pay-desc {
  font-size: 13px;
  color: var(--dim);
}

/* ---------- idea ---------- */
.idea {
  width: 100%;
  flex: 1;
  min-height: 180px;
  resize: none;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.5;
  padding: 14px;
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.idea:focus {
  border-color: var(--line-strong);
}

/* ---------- shared foot / buttons ---------- */
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
}

.counter {
  font-size: 12px;
  color: var(--dim);
  letter-spacing: 0.08em;
}

.btn {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--bg);
  background: var(--fg);
  border: 1px solid var(--fg);
  padding: 13px 26px;
  cursor: pointer;
  transition: transform 0.08s, opacity 0.15s, background 0.15s;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
  background: transparent;
  color: var(--dim);
  border-color: var(--line);
}

.btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ---------- verdict screens ---------- */
.verdict {
  text-align: center;
  padding: 0 6px;
}

.verdict-mark {
  font-size: 40px;
  line-height: 1;
  color: var(--bad);
  border: 1px solid var(--line);
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 22px;
  animation: pop 0.35s ease both;
}

.verdict-mark.ok {
  color: var(--ok);
}

@keyframes pop {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.verdict h1 {
  font-size: 22px;
  margin: 0 0 10px;
}

/* ---------- leaderboard ---------- */
.board {
  margin-top: 34px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.board-title {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--dim);
  margin-bottom: 12px;
  text-align: center;
}

.board-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.board-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  border: 1px solid var(--line);
  padding: 9px 12px;
  color: var(--fg);
}

.board-list li .pos {
  color: var(--dim);
  width: 26px;
}

.board-list li .nm {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0 8px;
}

.board-list li .ct {
  color: var(--ok);
  font-weight: 600;
}

.board-list li.me {
  border-color: var(--line-strong);
  background: #161616;
}

@media (min-width: 520px) {
  .head h1 {
    font-size: 28px;
  }
}

/* Respect reduced motion. */
@media (prefers-reduced-motion: reduce) {
  *,
  .screen,
  .terminal .line.show,
  .verdict-mark {
    animation: none !important;
  }
  .screen {
    opacity: 1;
    transform: none;
  }
}
