/* konzola.net, hand-written, no frameworks were harmed. */
:root {
  --bg-1: #2a2a2a;
  --bg-2: #0d0d0d;
  --fg: #d8d8d8;
  --dim: #888;
  --green: #4af626;
  --amber: #ffb000;
  --red: #ff5f56;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: grid;
  place-items: center;
  min-height: 100vh;
  overflow: hidden;
  background: radial-gradient(circle at center, var(--bg-1), var(--bg-2), #000);
  color: var(--fg);
  font-family: var(--mono);
}

.logo {
  width: min(100%, 300px);
  height: auto;
  cursor: pointer;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.2s ease;
}

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

.stranger {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  text-indent: -9999px;
  overflow: hidden;
  opacity: 0.01;
}

.hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--dim);
  opacity: 0.5;
  white-space: nowrap;
}

/* Tux speech bubble */
.bubble {
  position: absolute;
  top: calc(50% - 200px);
  left: 50%;
  transform: translateX(-50%);
  max-width: min(90vw, 360px);
  padding: 8px 12px;
  border: 1px solid #444;
  border-radius: 8px;
  background: #111;
  color: var(--fg);
  font-size: 13px;
  text-align: center;
}

/* Toasts */
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 8px 14px;
  border: 1px solid #333;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.85);
  color: var(--green);
  font-size: 13px;
  z-index: 30;
}

/* konsh: the terminal */
.term {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(60vh, 520px);
  display: flex;
  flex-direction: column;
  border-top: 1px solid #333;
  background: rgba(5, 5, 5, 0.94);
  color: var(--fg);
  font-size: 13px;
  line-height: 1.45;
  z-index: 20;
}

.term[hidden], .bubble[hidden], .toast[hidden] { display: none; }

.term-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px 4px 16px;
  border-bottom: 1px solid #222;
  color: var(--dim);
  font-size: 11px;
}

.term-bar-right { display: flex; align-items: center; gap: 10px; }

.term-close {
  min-width: 32px;
  min-height: 28px;
  border: 1px solid #333;
  border-radius: 4px;
  background: transparent;
  color: var(--fg);
  font: 18px/1 var(--mono);
  cursor: pointer;
}
.term-close:hover, .term-close:focus-visible { border-color: var(--green); color: var(--green); }

.term-out {
  flex: 1;
  overflow: auto;
  padding: 8px 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-overflow-scrolling: touch;
}

/* ASCII art keeps its shape; on narrow screens the output scrolls sideways
   instead of wrapping the drawing into noise. */
.term-out .t-art { white-space: pre; overflow-wrap: normal; width: max-content; }

/* On-screen keys, shown only on touch screens (see the media query below). */
.term-keys { display: none; gap: 8px; padding: 0 16px 10px; }
.term-keys button {
  flex: 1;
  min-height: 36px;
  border: 1px solid #333;
  border-radius: 4px;
  background: #111;
  color: var(--fg);
  font: 14px var(--mono);
}
.term-keys button:active { border-color: var(--green); color: var(--green); }

.term-line {
  display: flex;
  gap: 8px;
  padding: 6px 16px 10px;
}

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

.term-in {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  caret-color: var(--green);
}

.t-cmd { color: #fff; }
.t-ok { color: var(--green); }
.t-warn { color: var(--amber); }
.t-err { color: var(--red); }
.t-dim { color: var(--dim); }

/* Easter egg effects */
.barrel-roll { animation: roll 1s ease-in-out; }
@keyframes roll { to { transform: rotate(360deg); } }

.waddle { animation: waddle 0.25s ease-in-out 6 alternate; }
@keyframes waddle {
  from { transform: rotate(-8deg); }
  to { transform: rotate(8deg); }
}

.spin { animation: roll 0.6s linear 3; }

.sl {
  position: fixed;
  bottom: 30%;
  left: 100%;
  margin: 0;
  color: var(--fg);
  font-size: 12px;
  white-space: pre;
  z-index: 25;
  animation: choo 6s linear forwards;
}
@keyframes choo { to { transform: translateX(calc(-100vw - 100%)); } }

.matrix {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10;
}

/* Harlem Shake: background flips at most ~2.3 times per second (< 3 Hz). */
.hs-solo { animation: hs-shake 0.43s ease-in-out infinite; }
.hs-dance { animation: hs-dance 0.43s ease-in-out infinite alternate; }
body.hs-drop {
  background: radial-gradient(circle at center, #7b2ff7, #1a0533, #000);
  animation: hs-flash 0.86s steps(2, jump-none) infinite;
}
.hs-extra { position: fixed; z-index: 15; pointer-events: none; user-select: none; }
.hs-banner {
  position: fixed;
  top: 12%;
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  font-size: clamp(24px, 6vw, 56px);
  font-weight: bold;
  letter-spacing: 0.1em;
  white-space: nowrap;
  z-index: 16;
  pointer-events: none;
}
@keyframes hs-shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-12deg) translateY(-6px); }
  75% { transform: rotate(12deg) translateY(6px); }
}
@keyframes hs-dance {
  0% { transform: translate(-10px, 6px) rotate(-15deg) scale(1); }
  50% { transform: translate(10px, -8px) rotate(10deg) scale(1.15); }
  100% { transform: translate(-6px, 10px) rotate(20deg) scale(0.9); }
}
@keyframes hs-flash {
  from { filter: hue-rotate(0deg); }
  to { filter: hue-rotate(160deg); }
}

/* Text pages (404, secret stash) */
.page {
  max-width: 640px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
}
.page pre { overflow-x: auto; color: var(--green); }
.page a { color: var(--green); }

@media (max-width: 480px) {
  .bubble { top: 16px; }
}

/* Phones: full-screen shell; konzola.net.js shrinks it to the visible area
   when the on-screen keyboard opens. */
@media (max-width: 600px) {
  .term { top: 0; bottom: auto; height: 100dvh; border-top: 0; font-size: 12px; background: #050505; }
  .term-esc { display: none; }
  /* 16px or larger: iOS otherwise zooms the whole page when the input gets focus. */
  .term-in { font-size: 16px; }
}

@media (pointer: coarse) {
  .term-keys { display: flex; }
  .term-esc { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .barrel-roll, .waddle, .spin, .sl, .hs-solo, .hs-dance, body.hs-drop { animation: none; }
}
