@import url("https://fonts.googleapis.com/css2?family=VT323&display=swap");
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0a0a0a;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100vw;
  font-family: "VT323", monospace;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

.crt-container {
  position: relative;
  width: calc(100vw - 40px);
  height: clamp(400px, 90vh, 900px);
  background: #1a1a1a;
  border-radius: 20px;
  padding: clamp(20px, 5vw, 40px);
  box-shadow: 0 0 100px rgba(0, 255, 0, 0.3);
}

.power-button {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  background: radial-gradient(circle, #333, #111);
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5), 0 2px 10px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  border: 2px solid #222;
}

.power-button:hover {
  background: radial-gradient(circle, #444, #1a1a1a);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5), 0 2px 15px rgba(0, 255, 0, 0.2);
}

.power-button:active {
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.8), 0 1px 5px rgba(0, 0, 0, 0.3);
}

.power-button::before {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border: 3px solid #555;
  border-radius: 50%;
  border-top-color: transparent;
}

.power-button::after {
  content: "";
  position: absolute;
  width: 3px;
  height: 11px;
  background: #555;
  border-radius: 2px;
  top: 3px;
}

.power-led {
  position: absolute;
  top: -30px;
  width: 12px;
  height: 12px;
  background: #ff0000;
  border-radius: 50%;
  box-shadow: 0 0 5px #ff0000, inset 0 1px 2px rgba(255, 255, 255, 0.3);
  transition: all 0.3s;
}

.power-led.on {
  background: #00ff00;
  box-shadow: 0 0 10px #00ff00, 0 0 20px #00ff00, inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

.screen {
  position: absolute;
  top: clamp(20px, 5vw, 40px);
  left: clamp(20px, 5vw, 40px);
  right: clamp(20px, 5vw, 40px);
  bottom: clamp(20px, 5vw, 40px);
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8);
}

.screen::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.25) 0px, rgba(0, 0, 0, 0.25) 2px, rgba(0, 255, 0, 0.07) 2px, rgba(0, 255, 0, 0.07) 4px);
  pointer-events: none;
  z-index: 10;
  border-radius: 10px;
}

.screen::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
  pointer-events: none;
  z-index: 11;
  border-radius: 10px;
}

.screen-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: all 0.3s;
  z-index: 1;
  overflow: hidden;
  border-radius: 10px;
}

.screen-content.turning-off {
  animation: powerOff 0.8s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.screen-content.turning-on {
  animation: powerOn 1.2s cubic-bezier(0, 0, 0.2, 1) forwards;
}

.screen-content.powered-off {
  clip-path: inset(50% 50% 50% 50%);
  filter: brightness(0);
  opacity: 0;
}

.power-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  display: none;
}

@keyframes powerOff {
  0% {
    opacity: 1;
    clip-path: inset(0% 0% 0% 0%);
    filter: brightness(1);
    background: transparent;
  }
  20% {
    opacity: 1;
    clip-path: inset(5% 0% 5% 0%);
    filter: brightness(1.5);
    background: rgba(200, 200, 200, 0.1);
  }
  50% {
    opacity: 1;
    clip-path: inset(30% 0% 30% 0%);
    filter: brightness(2.5);
    background: rgba(220, 220, 220, 0.3);
  }
  75% {
    opacity: 1;
    clip-path: inset(49% 10% 49% 10%);
    filter: brightness(4);
    background: rgba(240, 240, 240, 0.6);
  }
  90% {
    opacity: 1;
    clip-path: inset(49.5% 40% 49.5% 40%);
    filter: brightness(6);
    background: rgba(255, 255, 255, 0.8);
  }
  95% {
    opacity: 1;
    clip-path: inset(49.8% 49% 49.8% 49%);
    filter: brightness(8);
    background: rgba(255, 255, 255, 0.95);
  }
  100% {
    opacity: 0;
    clip-path: inset(50% 50% 50% 50%);
    filter: brightness(10);
    background: #ffffff;
  }
}
@keyframes powerOn {
  0% {
    opacity: 0;
    clip-path: inset(50% 50% 50% 50%);
    filter: brightness(10);
    background: #ffffff;
  }
  5% {
    opacity: 1;
    clip-path: inset(49.8% 49% 49.8% 49%);
    filter: brightness(8);
    background: rgba(255, 255, 255, 0.95);
  }
  10% {
    opacity: 1;
    clip-path: inset(49.5% 40% 49.5% 40%);
    filter: brightness(6);
    background: rgba(255, 255, 255, 0.8);
  }
  25% {
    opacity: 1;
    clip-path: inset(49% 10% 49% 10%);
    filter: brightness(4);
    background: rgba(240, 240, 240, 0.6);
  }
  50% {
    opacity: 1;
    clip-path: inset(30% 0% 30% 0%);
    filter: brightness(2.5);
    background: rgba(220, 220, 220, 0.3);
  }
  80% {
    opacity: 1;
    clip-path: inset(5% 0% 5% 0%);
    filter: brightness(1.5);
    background: rgba(200, 200, 200, 0.1);
  }
  100% {
    opacity: 1;
    clip-path: inset(0% 0% 0% 0%);
    filter: brightness(1);
    background: transparent;
  }
}
.scanline {
  position: absolute;
  width: 100%;
  height: 100px;
  background: linear-gradient(to bottom, transparent 0%, rgba(255, 255, 255, 0.05) 50%, transparent 100%);
  animation: scan 8s linear infinite;
  pointer-events: none;
  z-index: 4;
  top: 0;
}

@keyframes scan {
  0% {
    top: -100px;
  }
  100% {
    top: 100%;
  }
}
.flicker {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  animation: flicker 0.15s infinite;
}

@keyframes flicker {
  0% {
    opacity: 0.97;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.95;
  }
}
.content {
  position: relative;
  width: 100%;
  height: 100%;
  padding: clamp(10px, 3vw, 20px);
  color: #00ff00;
  font-size: clamp(22px, 3vw, 30px);
  z-index: 1;
  overflow: hidden;
  text-shadow: 0 0 5px #00ff00, 0 0 10px #00ff00;
  display: flex;
  flex-direction: column;
}

.content::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.content::-webkit-scrollbar-track {
  background: #001100;
  border: 1px solid rgba(0, 255, 0, 0.3);
  border-radius: 4px;
}

.content::-webkit-scrollbar-thumb {
  background: #00ff00;
  box-shadow: 0 0 8px #00ff00;
  border-radius: 4px;
  border: 1px solid #00aa00;
}

.content::-webkit-scrollbar-thumb:hover {
  background: #00dd00;
  box-shadow: 0 0 12px #00ff00;
}

.content::-webkit-scrollbar-corner {
  background: #001100;
}

.header {
  padding-bottom: 10px;
  margin-bottom: 15px;
  flex-shrink: 0;
}

.header-top {
  border-top: 2px solid #00ff00;
  border-left: 2px solid #00ff00;
  border-right: 2px solid #00ff00;
  height: 0;
}

.header-title {
  border-left: 2px solid #00ff00;
  border-right: 2px solid #00ff00;
  padding: 5px 10px;
  text-align: center;
}

.header-bottom {
  border-bottom: 2px solid #00ff00;
  border-left: 2px solid #00ff00;
  border-right: 2px solid #00ff00;
  height: 0;
}

.output {
  margin-bottom: 20px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.line {
  margin-bottom: 5px;
}

.prompt {
  display: flex;
  align-items: center;
  margin-top: 10px;
  position: relative;
  flex-shrink: 0;
}

.prompt span {
  margin-right: 5px;
  white-space: nowrap;
}

.input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

#input {
  background: transparent;
  border: none;
  color: #00ff00;
  font-family: "VT323", monospace;
  font-size: inherit;
  outline: none;
  flex: 1;
  text-shadow: 0 0 5px #00ff00;
  caret-color: transparent;
}

.cursor {
  display: inline-block;
  width: 10px;
  height: 1em;
  background: #00ff00;
  animation: blink 1s step-end infinite;
  box-shadow: 0 0 5px #00ff00;
  position: absolute;
  left: 0;
  pointer-events: none;
}

@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}
.button-panel {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(0, 255, 0, 0.3);
  flex-shrink: 0;
}

.social-panel {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  flex-shrink: 0;
}

.social-button {
  background: transparent;
  border: 2px solid #00ff00;
  color: #00ff00;
  padding: 8px 12px;
  font-family: "VT323", monospace;
  font-size: 22px;
  cursor: pointer;
  text-shadow: 0 0 5px #00ff00;
  transition: all 0.1s;
  box-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 4px;
}

.social-button svg {
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 0 3px #00ff00);
}

.social-button:hover {
  background: #00ff00;
  color: #000;
  box-shadow: 0 0 15px #00ff00;
  text-shadow: none;
}

.social-button:hover svg {
  filter: none;
}

.social-button:active {
  transform: scale(0.95);
}

.crt-button {
  background: transparent;
  border: 2px solid #00ff00;
  color: #00ff00;
  padding: 8px 16px;
  font-family: "VT323", monospace;
  font-size: 26px;
  cursor: pointer;
  text-shadow: 0 0 5px #00ff00;
  transition: all 0.1s;
  box-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
}

.crt-button:hover {
  background: #00ff00;
  color: #000;
  box-shadow: 0 0 15px #00ff00;
  text-shadow: none;
}

.crt-button:active {
  transform: scale(0.95);
}

/* Removed glitch animation that was causing the shake effect */
/* ===================== QWERTY KEYBOARD (responsive only) ===================== */
.keyboard {
  display: none;
  /* hidden by default on desktop */
}

@media (max-width: 768px) {
  body {
    align-items: flex-start;
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    /* reserve space for the fixed keyboard (~220px) so it doesn't overlap */
    padding-bottom: 220px;
  }

  .crt-container {
    width: 100vw;
    height: auto;
    min-height: 50vh;
    border-radius: 0;
    /* minimal padding so the screen sits flush */
    padding: 6px 6px 4px;
    margin-bottom: 0;
  }

  .screen {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* fill the container tightly */
    height: calc(100vh - 220px - 10px);
    min-height: 260px;
    border-radius: 6px;
  }

  .keyboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #111;
    border-top: 2px solid rgba(0, 255, 0, 0.4);
    padding: 8px 4px 12px;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 255, 0, 0.15);
  }

  .keyboard-row {
    display: flex;
    gap: 4px;
    justify-content: center;
    width: 100%;
  }

  .key {
    background: #1a1a1a;
    border: 1px solid rgba(0, 255, 0, 0.5);
    color: #00ff00;
    font-family: "VT323", monospace;
    font-size: clamp(14px, 3.5vw, 20px);
    padding: 0;
    width: clamp(26px, 8.5vw, 42px);
    height: clamp(32px, 9vw, 46px);
    cursor: pointer;
    border-radius: 4px;
    text-shadow: 0 0 4px #00ff00;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 4px rgba(0, 255, 0, 0.1);
    transition: background 0.08s, box-shadow 0.08s, transform 0.08s;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .key:active,
.key.key--pressed {
    background: #00ff00;
    color: #000;
    text-shadow: none;
    box-shadow: 0 0 10px #00ff00;
    transform: scale(0.93);
  }

  .key--backspace {
    width: clamp(38px, 12vw, 58px);
    font-size: clamp(16px, 4vw, 22px);
  }

  .key--shift {
    width: clamp(38px, 12vw, 58px);
    font-size: clamp(16px, 4vw, 22px);
  }

  .key--shift.key--active {
    background: rgba(0, 255, 0, 0.25);
    box-shadow: 0 0 8px #00ff00;
  }

  .key--enter {
    width: clamp(44px, 14vw, 66px);
    font-size: clamp(16px, 4vw, 22px);
  }

  .key--space {
    flex: 1;
    max-width: 200px;
    font-size: clamp(12px, 3vw, 16px);
    letter-spacing: 1px;
  }

  .key--numbers,
.key--symbols {
    width: clamp(44px, 13vw, 62px);
    font-size: clamp(11px, 2.8vw, 15px);
  }
}