:root {
  color-scheme: light;
  --ink: #050505;
  --muted: #313131;
  --paper: #f7f3ff;
  --lime: #ccff1f;
  --mint: #39f0cc;
  --coral: #ff4d2f;
  --blue: #095dff;
  --pink: #ff65c8;
  --phone: #070707;
  --screen: #f8f3ff;
  --shadow: 14px 14px 0 rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Arial Black", Impact, Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.14)),
    url("assets/bg-yellow-green.jpg") center / cover fixed,
    var(--paper);
}

button,
select {
  border: 4px solid var(--ink);
  border-radius: 8px;
  padding: 0.78rem 0.95rem;
  font: inherit;
  font-weight: 700;
  color: #111;
  background: var(--lime);
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 6px 6px 0 var(--ink);
}

select {
  width: 100%;
  min-width: 0;
  background: #fff7fb;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 3px 3px 0 var(--ink);
}

button:disabled {
  color: #7b858a;
  background: #d5ddd2;
  cursor: not-allowed;
  box-shadow: none;
}

select:disabled {
  color: #7b858a;
  background: #d5ddd2;
  cursor: not-allowed;
  box-shadow: none;
}

.brand-strip {
  width: min(1040px, calc(100% - 32px));
  margin: 14px auto 0;
  border: 5px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  background: var(--pink);
}

.brand-strip img {
  display: block;
  width: 100%;
  height: auto;
}

.scene {
  width: min(1040px, calc(100% - 32px));
  min-height: calc(100vh - 116px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(170px, 0.5fr) minmax(420px, 520px);
  gap: clamp(18px, 3vw, 34px);
  align-items: center;
  padding: 22px 0 36px;
}

.lesson-panel {
  max-width: 300px;
  align-self: start;
  margin-top: clamp(18px, 7vh, 64px);
}

.intro {
  max-width: 24ch;
  margin: 0;
  border: 4px solid var(--ink);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.94rem;
  line-height: 1.28;
  color: var(--ink);
  background: var(--lime);
  box-shadow: 6px 6px 0 var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
}

.phone-zone {
  display: flex;
  align-items: center;
  justify-content: center;
}

.phone {
  position: relative;
  width: min(520px, 100%);
  margin: 0 auto;
  border: 16px solid var(--phone);
  border-radius: 46px;
  background: var(--phone);
  box-shadow: var(--shadow);
}

.phone::before,
.phone::after {
  content: "";
  position: absolute;
  inset: 18px;
  z-index: 3;
  border-radius: 28px;
  pointer-events: none;
  opacity: 0;
}

.phone::before {
  border: 3px solid rgba(57, 240, 204, 0.75);
  transform: translate(-6px, 3px);
}

.phone::after {
  border: 3px solid rgba(255, 77, 47, 0.75);
  transform: translate(6px, -3px);
}

.phone.glitching {
  animation: phone-jitter 180ms steps(2, end) 4;
}

.phone.glitching::before,
.phone.glitching::after {
  animation: chroma-split 180ms steps(2, end) 4;
}

.phone-top {
  height: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

.speaker {
  width: 78px;
  height: 8px;
  border-radius: 0;
  background: #313640;
}

.camera-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4e5664;
}

.phone-screen {
  position: relative;
  min-height: min(760px, calc(100vh - 220px));
  overflow: hidden;
  border-radius: 23px;
  background:
    linear-gradient(rgba(248, 243, 255, 0.92), rgba(248, 243, 255, 0.92)),
    var(--screen);
  padding: 16px;
}

.glitch-lines {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: multiply;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.18) 0,
      rgba(0, 0, 0, 0.18) 2px,
      transparent 2px,
      transparent 7px
    ),
    linear-gradient(90deg, rgba(255, 77, 47, 0.22), transparent 28%, rgba(9, 93, 255, 0.22));
}

.phone.glitching .glitch-lines {
  animation: scan-glitch 180ms steps(2, end) 4;
}

.phone.glitching .phone-screen > *:not(.glitch-lines) {
  animation: content-slip 180ms steps(2, end) 4;
}

.status-bar {
  position: relative;
  z-index: 7;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.phone-icons {
  display: inline-flex;
  align-items: end;
  gap: 8px;
}

.signal-bars {
  display: inline-flex;
  align-items: end;
  gap: 2px;
  height: 13px;
}

.signal-bars i {
  display: block;
  width: 3px;
  background: var(--ink);
}

.signal-bars i:nth-child(1) {
  height: 4px;
}

.signal-bars i:nth-child(2) {
  height: 7px;
}

.signal-bars i:nth-child(3) {
  height: 10px;
}

.signal-bars i:nth-child(4) {
  height: 13px;
}

.wifi-icon {
  position: relative;
  width: 16px;
  height: 12px;
  overflow: hidden;
}

.wifi-icon::before,
.wifi-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  border: 3px solid var(--ink);
  border-color: var(--ink) transparent transparent transparent;
  border-radius: 50%;
  transform: translateX(-50%);
}

.wifi-icon::before {
  top: 1px;
  width: 16px;
  height: 16px;
}

.wifi-icon::after {
  top: 6px;
  width: 8px;
  height: 8px;
}

.battery-icon {
  position: relative;
  width: 24px;
  height: 12px;
  border: 3px solid var(--ink);
  border-radius: 3px;
  background: linear-gradient(90deg, var(--ink) 68%, transparent 68%);
}

.battery-icon::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 2px;
  width: 3px;
  height: 4px;
  background: var(--ink);
}

.camera-stage {
  position: relative;
  aspect-ratio: 4 / 5;
  margin-top: 10px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: #20262b;
  box-shadow: 5px 5px 0 var(--ink);
}

video,
canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

canvas {
  pointer-events: none;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: 28px;
  color: #f4f7ea;
  text-align: center;
  background:
    url("assets/star.png") center 16% / 34% auto no-repeat,
    linear-gradient(135deg, rgba(9, 93, 255, 0.72), rgba(255, 77, 47, 0.7), rgba(204, 255, 31, 0.78)),
    #20262b;
}

.camera-placeholder.hidden {
  display: none;
}

.home-screen {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-content: start;
  gap: 18px;
  padding: 54px 22px 22px;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease;
  background:
    linear-gradient(135deg, rgba(255, 101, 200, 0.88), rgba(204, 255, 31, 0.84) 48%, rgba(9, 93, 255, 0.88)),
    #ff65c8;
}

.home-screen.visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.home-widgets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.home-widget {
  min-height: 92px;
  border: 4px solid var(--ink);
  border-radius: 16px;
  padding: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 5px 5px 0 var(--ink);
}

.home-widget span,
.home-widget strong {
  display: block;
}

.home-widget span {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  font-weight: 900;
}

.home-widget strong {
  margin-top: 6px;
  font-size: 2rem;
  line-height: 1;
}

.weather-widget {
  background:
    radial-gradient(circle at 78% 28%, #ffcf27 0 18px, transparent 19px),
    rgba(255, 255, 255, 0.76);
}

.calendar-widget {
  background:
    linear-gradient(var(--coral) 0 28%, rgba(255, 255, 255, 0.82) 28%),
    rgba(255, 255, 255, 0.76);
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px 12px;
  align-content: start;
}

.app-icon {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
}

.app-icon span {
  position: relative;
  display: block;
  width: 58px;
  height: 58px;
  border: 4px solid var(--ink);
  border-radius: 12px;
  box-shadow: 5px 5px 0 var(--ink);
  overflow: hidden;
}

.app-icon p {
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.6);
}

.app-tiktak span {
  background: var(--coral);
}

.app-tiktak span::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 12px;
  width: 10px;
  height: 26px;
  border-left: 6px solid white;
  border-bottom: 6px solid white;
  transform: skew(-8deg);
}

.app-tiktak span::after {
  content: "";
  position: absolute;
  left: 27px;
  top: 14px;
  width: 12px;
  height: 7px;
  background: white;
  box-shadow: -10px 18px 0 white;
}

.app-snupchat span {
  background: #ffcf27;
}

.app-snupchat span::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 11px;
  width: 24px;
  height: 29px;
  background: white;
  clip-path: polygon(50% 0, 78% 13%, 82% 38%, 100% 50%, 80% 60%, 84% 82%, 62% 76%, 50% 100%, 38% 76%, 16% 82%, 20% 60%, 0 50%, 18% 38%, 22% 13%);
}

.app-snupchat span::after {
  content: "";
  position: absolute;
  left: 22px;
  top: 23px;
  width: 4px;
  height: 4px;
  background: var(--ink);
  box-shadow: 10px 0 0 var(--ink), 5px 8px 0 2px var(--ink);
}

.app-game span {
  background: var(--blue);
}

.app-game span::before {
  content: "+";
  position: absolute;
  left: 13px;
  top: 11px;
  color: white;
  font-size: 1.55rem;
  line-height: 1;
}

.app-game span::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 21px;
  width: 8px;
  height: 8px;
  background: white;
  box-shadow: 10px 0 0 white, 5px 10px 0 white;
}

.app-music span {
  background: #ffcf27;
}

.app-music span::before {
  content: "♪";
  position: absolute;
  left: 16px;
  top: 7px;
  color: var(--ink);
  font-size: 2rem;
}

.app-camera span {
  background: #f8f3ff;
}

.app-camera span::before {
  content: "";
  position: absolute;
  inset: 16px 12px 13px;
  border: 4px solid var(--ink);
  border-radius: 8px;
}

.app-camera span::after {
  content: "";
  position: absolute;
  left: 23px;
  top: 23px;
  width: 11px;
  height: 11px;
  border: 4px solid var(--ink);
  border-radius: 50%;
}

.app-draw span {
  background: #ff8ae1;
}

.app-draw span::before {
  content: "";
  position: absolute;
  left: 28px;
  top: 12px;
  width: 9px;
  height: 30px;
  background: white;
  transform: rotate(38deg);
}

.app-map span {
  background: #bdf347;
}

.app-map span::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 13px;
  width: 27px;
  height: 30px;
  background:
    linear-gradient(90deg, transparent 31%, var(--ink) 31% 42%, transparent 42% 63%, var(--ink) 63% 74%, transparent 74%),
    white;
  transform: skewY(-8deg);
}

.app-brain span {
  background: #a874ff;
}

.app-brain span::before {
  content: "?";
  position: absolute;
  left: 18px;
  top: 5px;
  color: white;
  font-size: 2.15rem;
  line-height: 1;
}

.app-weather span {
  background: #8fd7ff;
}

.app-weather span::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 12px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffcf27;
  box-shadow: 14px 16px 0 2px white;
}

.app-photos span {
  background: #fff7fb;
}

.app-photos span::before {
  content: "";
  position: absolute;
  left: 24px;
  top: 9px;
  width: 10px;
  height: 40px;
  border-radius: 99px;
  background: var(--coral);
  box-shadow: 0 0 0 0 var(--coral);
  transform: rotate(0deg);
}

.app-photos span::after {
  content: "";
  position: absolute;
  left: 24px;
  top: 9px;
  width: 10px;
  height: 40px;
  border-radius: 99px;
  background: var(--blue);
  transform: rotate(60deg);
  box-shadow: 0 0 0 0 var(--blue);
}

.app-notes span {
  background: #fff4a8;
}

.app-notes span::before {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  top: 16px;
  height: 4px;
  background: var(--ink);
  box-shadow: 0 10px 0 var(--ink), 0 20px 0 var(--ink);
}

.app-mail span {
  background: #f8f3ff;
}

.app-mail span::before {
  content: "";
  position: absolute;
  inset: 15px 11px;
  border: 4px solid var(--ink);
  background: white;
}

.app-mail span::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 20px;
  width: 30px;
  height: 18px;
  border-left: 4px solid var(--ink);
  border-bottom: 4px solid var(--ink);
  transform: rotate(-45deg);
}

.app-browser span {
  background: var(--mint);
}

.app-browser span::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 13px;
  width: 25px;
  height: 25px;
  border: 4px solid white;
  border-radius: 50%;
}

.app-browser span::after {
  content: "";
  position: absolute;
  left: 28px;
  top: 15px;
  width: 4px;
  height: 25px;
  background: white;
  box-shadow: -11px 11px 0 -1px white, 11px 11px 0 -1px white;
}

.app-files span {
  background: #64b5ff;
}

.app-files span::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 16px;
  width: 35px;
  height: 27px;
  background: white;
  clip-path: polygon(0 18%, 38% 18%, 48% 0, 100% 0, 100% 100%, 0 100%);
}

.app-calc span {
  background: #30343b;
}

.app-calc span::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 12px;
  width: 32px;
  height: 8px;
  background: white;
  box-shadow: 0 14px 0 var(--lime), 12px 14px 0 var(--lime), 24px 14px 0 var(--lime), 0 28px 0 var(--lime), 12px 28px 0 var(--lime), 24px 28px 0 var(--lime);
}

.app-ultra span {
  background: linear-gradient(135deg, var(--pink), var(--lime), var(--blue));
}

.app-ultra span::before {
  content: "U";
  position: absolute;
  left: 15px;
  top: 6px;
  color: var(--ink);
  font-size: 2.15rem;
  line-height: 1;
}

.app-ring span {
  background: #31d95f;
}

.app-ring span::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 12px;
  width: 23px;
  height: 31px;
  border: 7px solid white;
  border-top-color: transparent;
  border-right-color: transparent;
  border-radius: 10px;
  transform: rotate(-35deg);
}

.app-messages span {
  background: #39f0cc;
}

.app-messages span::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 14px;
  width: 34px;
  height: 25px;
  background: white;
  border-radius: 12px;
}

.app-messages span::after {
  content: "";
  position: absolute;
  left: 20px;
  bottom: 13px;
  width: 12px;
  height: 12px;
  background: white;
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.quick-apps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 12px;
  border: 4px solid rgba(5, 5, 5, 0.82);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: 5px 5px 0 rgba(5, 5, 5, 0.45);
  backdrop-filter: blur(4px);
}

.quick-apps .app-icon {
  font-size: 0.62rem;
}

.quick-apps .app-icon span {
  width: 48px;
  height: 48px;
  box-shadow: none;
}

.face-icon {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  margin: 0 auto;
  border: 5px solid currentColor;
  border-radius: 8px;
  font-size: 3rem;
  font-weight: 900;
  color: var(--ink);
  background: var(--lime);
  box-shadow: 6px 6px 0 var(--ink);
}

.lock-card {
  margin-top: 14px;
  border: 4px solid var(--ink);
  border-radius: 8px;
  padding: 12px;
  background: #fff7fb;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  box-shadow: 5px 5px 0 var(--ink);
}

.lock-card.unlocked {
  background: var(--lime);
}

.lock-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 4px solid var(--ink);
  border-radius: 4px;
  color: white;
  background: var(--coral);
  font-weight: 900;
}

.unlocked .lock-icon {
  background: #1f9b65;
}

.lock-title {
  margin: 0;
  font-weight: 900;
  text-transform: uppercase;
}

.lock-message {
  margin: 0;
  color: var(--ink);
  line-height: 1.35;
  font-size: 0.94rem;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
}

.detected-box,
.hint-box {
  margin-top: 12px;
  border-radius: 8px;
  padding: 12px;
  line-height: 1.35;
}

.hidden-after-unlock {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.detected-box {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 4px solid var(--ink);
  color: var(--ink);
  background: var(--mint);
  box-shadow: 5px 5px 0 var(--ink);
  text-transform: uppercase;
}

.detected-box strong {
  text-align: right;
}

.hint-box {
  min-height: 64px;
  border: 4px solid var(--ink);
  background:
    linear-gradient(90deg, rgba(255, 101, 200, 0.35), rgba(255, 77, 47, 0.25)),
    #fff8d9;
  box-shadow: 5px 5px 0 var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
}

.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: min(100%, 260px);
  margin-top: 18px;
  padding: 12px;
  border: 4px solid var(--ink);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 101, 200, 0.45), rgba(204, 255, 31, 0.55)),
    #fff7fb;
  box-shadow: 6px 6px 0 var(--ink);
}

.camera-select-label {
  margin-bottom: -8px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

#start-camera {
  background: var(--mint);
}

.controls button:last-child {
  background: #fff7fb;
}

@media (max-width: 860px) {
  .scene {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 14px;
    min-height: auto;
    padding-top: 16px;
  }

  .lesson-panel {
    max-width: min(520px, 100%);
    margin: 0 auto;
    align-self: auto;
    text-align: center;
  }

  .intro {
    max-width: min(38ch, 100%);
    margin-inline: auto;
  }

  .phone-screen {
    min-height: 640px;
  }

  .phone-zone {
    width: min(520px, 100%);
    margin: 0 auto;
  }

  .controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: min(520px, 100%);
    margin-inline: auto;
  }
}

@media (max-width: 430px) {
  .brand-strip {
    width: min(100% - 18px, 1040px);
    border-width: 4px;
    box-shadow: 5px 5px 0 var(--ink);
  }

  .brand-strip img {
    height: auto;
  }

  .scene {
    width: min(100% - 18px, 1040px);
    padding: 12px 0 20px;
  }

  .intro {
    font-size: 0.88rem;
    padding: 9px 10px;
  }

  .phone {
    border-width: 9px;
    border-radius: 28px;
  }

  .phone-screen {
    padding: 12px;
    min-height: 610px;
  }

  .home-screen {
    padding: 50px 14px 16px;
    gap: 12px;
  }

  .home-widget {
    min-height: 78px;
    padding: 10px;
  }

  .home-widget strong {
    font-size: 1.65rem;
  }

  .app-grid {
    gap: 10px 7px;
  }

  .app-icon span {
    width: 50px;
    height: 50px;
  }

  .quick-apps {
    gap: 6px;
    padding: 8px;
  }

  .quick-apps .app-icon span {
    width: 42px;
    height: 42px;
  }

  .controls {
    grid-template-columns: 1fr;
  }
}

@keyframes phone-jitter {
  0% {
    transform: translate(0, 0) skew(0deg);
  }
  25% {
    transform: translate(3px, -2px) skew(0.7deg);
  }
  50% {
    transform: translate(-4px, 2px) skew(-0.6deg);
  }
  75% {
    transform: translate(2px, 1px) skew(0.4deg);
  }
  100% {
    transform: translate(0, 0) skew(0deg);
  }
}

@keyframes chroma-split {
  0%, 100% {
    opacity: 0;
  }
  25%, 75% {
    opacity: 0.9;
  }
}

@keyframes scan-glitch {
  0%, 100% {
    opacity: 0;
    transform: translateY(0);
  }
  25% {
    opacity: 0.75;
    transform: translateY(-12px);
  }
  50% {
    opacity: 0.35;
    transform: translateY(10px);
  }
  75% {
    opacity: 0.65;
    transform: translateY(-4px);
  }
}

@keyframes content-slip {
  0%, 100% {
    transform: translate(0, 0);
    filter: none;
  }
  25% {
    transform: translate(5px, 0);
    filter: hue-rotate(18deg) contrast(1.25);
  }
  50% {
    transform: translate(-6px, 1px);
    filter: saturate(1.5);
  }
  75% {
    transform: translate(2px, -1px);
    filter: hue-rotate(-22deg) contrast(1.2);
  }
}
