:root{
  --bg:#060610;
  --panel:rgba(255,255,255,.065);
  --line:rgba(255,255,255,.11);
  --muted:#8583a2;
  --purple:#7657ff;
  --cyan:#75efff;
  --pink:#ff3b9d;
  --good:#ffe66d;
}

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

html{
  background:var(--bg);
  scroll-behavior:smooth
}

body{
  margin:0;
  min-height:100dvh;
  color:#fff;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:
    radial-gradient(circle at 50% -10%,rgba(104,76,255,.3),transparent 36%),
    radial-gradient(circle at 0 55%,rgba(0,220,255,.1),transparent 30%),
    radial-gradient(circle at 100% 75%,rgba(255,0,140,.1),transparent 30%),
    linear-gradient(180deg,#111126 0%,#080812 48%,#040409 100%);
  overflow-x:hidden
}

body:before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  opacity:.035;
  background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E")
}

.orb{
  position:fixed;
  width:320px;
  height:320px;
  border-radius:50%;
  filter:blur(100px);
  opacity:.14;
  pointer-events:none
}

.orb.one{
  background:#704cff;
  top:-170px;
  left:-120px
}

.orb.two{
  background:#00e5ff;
  right:-170px;
  bottom:-150px
}

.app{
  position:relative;
  z-index:1;
  width:min(100%,820px);
  margin:auto;
  padding:26px 12px 54px;
  text-align:center
}

.brand{
  display:inline-flex;
  align-items:center;
  gap:9px;
  margin:4px 0 8px;
  color:#9e9abf;
  font-size:10px;
  font-weight:800;
  letter-spacing:4px;
  text-transform:uppercase
}

.brand:after{
  content:"";
  width:26px;
  height:1px;
  background:linear-gradient(
    90deg,
    rgba(117,239,255,.0),
    rgba(117,239,255,.75)
  )
}

.brand-dot{
  width:7px;
  height:7px;
  border-radius:50%;
  background:#8b5cf6;
  box-shadow:0 0 10px #8b5cf6,0 0 25px #8b5cf6
}

h1{
  margin:0;
  font-family:ui-rounded,"Arial Rounded MT Bold","Trebuchet MS",system-ui,sans-serif;
  font-size:clamp(50px,11vw,88px);
  line-height:.88;
  font-weight:900;
  letter-spacing:-5px;
  text-shadow:0 10px 35px rgba(0,0,0,.35)
}

h1 span{
  color:#f8f7ff
}

h1 em{
  font-style:normal;
  background:linear-gradient(
    110deg,
    #9a8cff 0%,
    #75efff 48%,
    #ff71bd 100%
  );
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
  text-shadow:none
}

.topbar{
  display:flex;
  justify-content:center;
  gap:7px;
  flex-wrap:wrap;
  margin:18px auto 12px
}

.button{
  min-height:42px;
  padding:0 14px;
  border:1px solid var(--line);
  border-radius:12px;
  color:#fff;
  background:rgba(255,255,255,.07);
  font:900 13px inherit;
  cursor:pointer;
  transition:
    background .15s ease,
    box-shadow .15s ease
}

.button:hover{
  background:rgba(255,255,255,.1)
}

.button:active{
  transform:scale(.96)
}

.button.primary{
  background:linear-gradient(
    135deg,
    #7053ff,
    #a05bff 55%,
    #ff4da9
  );
  border-color:rgba(255,255,255,.18);
  box-shadow:0 8px 28px rgba(118,87,255,.22)
}

.button.ghost{
  background:rgba(255,255,255,.04)
}

.button:disabled{
  opacity:.4;
  cursor:not-allowed
}

.board-shell{
  position:relative;
  width:min(92vw,620px);
  max-width:100%;
  margin:0 auto;
  padding:7px;
  border-radius:25px;
  background:linear-gradient(
    145deg,
    rgba(255,255,255,.13),
    rgba(255,255,255,.025)
  );
  box-shadow:
    0 35px 80px rgba(0,0,0,.48),
    0 0 0 1px rgba(255,255,255,.07)
}

.board{
  width:100%;
  aspect-ratio:1;
  padding:5px;
  display:grid;
  grid-template-columns:repeat(5,1fr);
  grid-template-rows:repeat(5,1fr);
  gap:clamp(3px,.8vw,6px);
  border-radius:19px;
  background:#05050d;
  box-shadow:inset 0 0 35px rgba(0,0,0,.8);
  touch-action:none;
  user-select:none
}

.tile{
  position:relative;
  min-width:0;
  min-height:0;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  border-radius:clamp(6px,1.5vw,13px);
  color:#fff;
  font-size:clamp(18px,7vw,46px);
  font-weight:1000;
  line-height:1;
  user-select:none;
  cursor:pointer;

  transition:
    filter .08s ease,
    box-shadow .08s ease
}

.tile:before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background:
    linear-gradient(
      135deg,
      rgba(255,255,255,.34),
      transparent 35%,
      transparent 65%,
      rgba(0,0,0,.13)
    )
}

.tile:after{
  content:"";
  position:absolute;
  width:70%;
  height:40%;
  top:-15%;
  left:15%;
  border-radius:50%;
  pointer-events:none;
  background:rgba(255,255,255,.22);
  filter:blur(13px)
}

.tile-number{
  position:relative;
  z-index:2;
  text-shadow:
    0 2px rgba(0,0,0,.16),
    0 4px 15px rgba(0,0,0,.18)
}

.tile.selected{
  z-index:10;
  filter:brightness(1.15) saturate(1.15);
  box-shadow:
    inset 0 2px rgba(255,255,255,.45),
    inset 0 -5px rgba(0,0,0,.2),
    0 0 0 3px rgba(255,255,255,.95),
    0 0 25px rgba(255,255,255,.65)!important;
  transform:scale(1.025)
}

.tile.pressed{
  transform:scale(.96);
  filter:brightness(1.08)
}

.tile.move-pop{
  animation:tileMovePop .15s ease-out
}

@keyframes tileMovePop{
  0%{
    transform:scale(.97)
  }
  55%{
    transform:scale(1.025)
  }
  100%{
    transform:scale(1)
  }
}

.message{
  min-height:42px;
  margin-top:14px;
  color:#fff;
  font-size:clamp(18px,4vw,27px);
  font-weight:1000;
  opacity:0;
  transform:translateY(5px);
  transition:.2s
}

.message.show{
  opacity:1;
  transform:none
}

.message span{
  font-variant-numeric:tabular-nums
}

.share-row{
  display:flex;
  justify-content:center;
  gap:8px;
  flex-wrap:wrap
}

.share{
  display:none;
  min-height:42px;
  padding:0 18px;
  border:0;
  border-radius:13px;
  color:#08080f;
  background:linear-gradient(135deg,#fff,#c9f8ff);
  font:1000 13px inherit;
  cursor:pointer
}

.share.visible{
  display:inline-flex;
  align-items:center
}

.notice{
  position:fixed;
  left:50%;
  bottom:20px;
  transform:translate(-50%,20px);
  opacity:0;
  pointer-events:none;
  z-index:200;
  padding:11px 15px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:12px;
  background:#141423;
  box-shadow:0 12px 40px #0008;
  font-weight:900;
  transition:.2s
}

.notice.show{
  opacity:1;
  transform:translate(-50%,0)
}

.modal-back{
  position:fixed;
  inset:0;
  z-index:100;
  display:none;
  align-items:center;
  justify-content:center;
  padding:18px;
  background:#000b;
  backdrop-filter:blur(10px)
}

.modal-back.show{
  display:flex
}

.modal-back.tutorial-mode{
  background:rgba(3,3,12,.34);
  align-items:flex-start;
  padding-top:clamp(18px,7vh,72px)
}

.modal-back.tutorial-mode .modal{
  background:rgba(9,9,20,.92);
  box-shadow:
    0 24px 90px rgba(0,0,0,.62),
    0 0 0 1px rgba(117,239,255,.06)
}

.tutorial-board-visible .tile-number{
  visibility:hidden
}

.tutorial-board-visible .tile{
  cursor:default
}

.modal{
  width:min(620px,100%);
  max-height:90dvh;
  overflow:auto;
  padding:20px;
  border:1px solid var(--line);
  border-radius:20px;
  background:#0d0d1a;
  box-shadow:0 30px 100px #000c;
  text-align:left
}

.modal h2{
  margin:0 0 8px
}

.modal p{
  color:#aaa7c0;
  line-height:1.5
}

.close{
  float:right;
  border:0;
  background:transparent;
  color:#aaa;
  font-size:22px;
  cursor:pointer
}

.device-choice{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin:16px 0
}

.device-card{
  padding:15px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;
  background:rgba(255,255,255,.035)
}

.device-card.recommended{
  border-color:rgba(117,239,255,.32);
  box-shadow:0 0 24px rgba(117,239,255,.08)
}

.device-title{
  font-size:11px;
  letter-spacing:2.5px;
  font-weight:1000;
  color:#75efff;
  margin-bottom:10px
}

.device-card ul{
  margin:0;
  padding-left:18px;
  color:#aaa7c0;
  line-height:1.55;
  font-size:13px
}

.device-card li+li{
  margin-top:7px
}

.device-card b{
  color:#fff
}

.tutorial-note{
  font-size:12px!important;
  color:#8582a1!important;
  line-height:1.5
}

.tutorial-start{
  width:100%;
  min-height:44px
}

.hidden{
  display:none!important
}

.confetti{
  animation:fall 2.4s linear forwards
}

@keyframes fall{
  to{
    transform:translateY(110vh) rotate(720deg);
    opacity:0
  }
}

.controls{
  display:flex;
  justify-content:center;
  gap:8px;
  flex-wrap:wrap;
  margin:14px auto 10px
}

.scoreline{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:52px;
  flex-wrap:wrap;
  margin:10px auto 16px
}

.scoreline.inspection.active{
  gap:0
}

.scoreline div,
.inspection-info{
  display:flex;
  align-items:baseline;
  justify-content:center;
  gap:7px
}

.scoreline span{
  font-size:10px;
  letter-spacing:2px;
  color:#777795;
  font-weight:900
}

.scoreline strong{
  font-size:26px;
  font-variant-numeric:tabular-nums;
  min-width:76px
}

.inspection.active .game-stat{
  display:none
}

.inspection:not(.active) .inspection-info{
  display:none
}


.board-shell.locked{
  pointer-events:none
}

@media(max-width:600px){
  .app{
    padding:18px 7px 38px
  }

  .board-shell{
    padding:5px;
    border-radius:19px
  }

  .board{
    padding:3px;
    border-radius:14px
  }

  .controls .button{
    padding:0 10px
  }

  .device-choice{
    grid-template-columns:1fr
  }

  .scoreline{
    gap:28px
  }

  .inspection-copy{
    width:100%;
    order:4
  }
}

@media(max-width:380px){
  h1{
    font-size:39px;
    letter-spacing:-2.5px
  }
}

@media(prefers-reduced-motion:reduce){
  *,
  *:before,
  *:after{
    animation-duration:.01ms!important;
    transition-duration:.01ms!important
  }
}
