:root{
  --bg:#f3f3f3;
  --card:#ffffff;
  --text:#111;
  --muted:#6b6b6b;
  --line:#e8e8e8;

  --green:#b6f400;

  --blue:#2f80ff;
  --orange:#ff9a3c;
  --purple:#a05bff;
  --gray:#5e6b73;

  --shadow:0 18px 60px rgba(0,0,0,.10);
  --radius:22px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
}

.page{
  min-height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:36px 16px;
}

.shell{
  width:min(980px, 100%);
  background:var(--card);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:34px 34px 26px;
}

.h1{
  margin:0;
  text-align:center;
  font-size:40px;
  letter-spacing:.2px;
}

.sub{
  text-align:center;
  color:var(--muted);
  margin-top:8px;
  margin-bottom:0;
  line-height:1.45;
}

.line{
  height:2px;
  background:var(--green);
  margin:18px 0 26px;
  border-radius:999px;
}

.tabs{
  display:flex;
  gap:14px;
  justify-content:center;
  flex-wrap:wrap;
  margin-bottom:26px;
}

.tab{
  text-decoration:none;
  color:#fff;
  font-weight:700;
  font-size:14px;
  padding:12px 18px;
  border-radius:12px;
  transition:transform .15s ease, filter .15s ease;
  box-shadow:0 10px 22px rgba(0,0,0,.10);
  border:1px solid rgba(255,255,255,.18);
  cursor:pointer;
  user-select:none;
}

.tab:hover{ transform:translateY(-2px); filter:brightness(1.02); }
.tab-blue{ background:var(--blue); }
.tab-orange{ background:var(--orange); }
.tab-purple{ background:var(--purple); }
.tab-gray{ background:var(--gray); }

.tab.active{
  outline: 3px solid rgba(182,244,0,.55);
  outline-offset: 2px;
}

.grid{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap:18px;
  align-items:start;
}

.box{
  border-left:4px solid var(--green);
  padding:18px 18px;
  background:#fff;
  border-radius:16px;
  border:1px solid var(--line);
}

.h2{
  margin:0 0 14px;
  font-size:22px;
}

.list{
  list-style:none;
  padding:0;
  margin:0;
  display:flex;
  flex-direction:column;
  gap:10px;
  line-height:1.5;
}

.check{
  display:inline-flex;
  width:24px;
  height:24px;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  background:rgba(182,244,0,.22);
  color:#2a2a2a;
  font-weight:800;
  margin-right:10px;
}

.footer{
  margin-top:26px;
  padding-top:18px;
  border-top:1px solid var(--line);
  text-align:center;
  color:var(--muted);
  font-size:13px;
}

/* Controls / forms */
.form{ display:grid; gap:12px; }
label{ font-size:13px; color:var(--muted); display:block; margin-bottom:6px; }

input, select{
  width:100%;
  padding:12px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  font-size:14px;
  outline:none;
  background:#fff;
}

input:focus, select:focus{
  border-color:rgba(47,128,255,.45);
  box-shadow:0 0 0 4px rgba(47,128,255,.10);
}

.actions{ display:flex; gap:10px; flex-wrap:wrap; margin-top:6px; }

.btn{
  border:0;
  cursor:pointer;
  padding:12px 16px;
  border-radius:12px;
  font-weight:800;
  font-size:14px;
  transition:transform .15s ease, filter .15s ease;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}

.btn:hover{ transform:translateY(-2px); filter:brightness(1.02); }

.btn-accent{ background:var(--green); color:#111; }
.btn-ghost{ background:#fff; border:1px solid var(--line); color:#111; }

.btn:disabled{
  opacity:.55;
  cursor:not-allowed;
  transform:none !important;
  filter:none !important;
}

/* Lab 3 puzzle specific */
.note{
  color:var(--muted);
  font-size:13px;
  margin-top:8px;
  line-height:1.45;
}

.upload-area{
  border:2px dashed var(--line);
  border-radius:16px;
  padding:18px;
  text-align:center;
  transition:border-color .15s ease, background .15s ease;
  background:#fff;
}

.upload-area.drag-over{
  border-color: rgba(47,128,255,.55);
  background: rgba(47,128,255,.05);
}

.preview-container{ display:none; text-align:center; }
.image-preview{
  width:100%;
  max-height:220px;
  border-radius:16px;
  border:1px solid var(--line);
  background:#fff;
  object-fit:contain;
  box-shadow:0 10px 22px rgba(0,0,0,.08);
  margin: 10px 0 12px;
}

.stats{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:10px;
  margin-top:12px;
}

.stat{
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px;
  padding:12px;
  text-align:center;
}

.stat-value{
  font-size:22px;
  font-weight:900;
}

.stat-label{
  font-size:12px;
  color:var(--muted);
  margin-top:4px;
}

.puzzle-wrap{
  background:#fff;
  border:1px solid var(--line);
  border-radius:18px;
  overflow:hidden;
  box-shadow:0 10px 30px rgba(0,0,0,.08);
  min-height:420px;
  position:relative;
}

.puzzle-container{
  position:relative;
  width:100%;
  height:520px;
}

.placeholder{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  color:var(--muted);
  gap:10px;
  padding:20px;
  text-align:center;
}

.placeholder i{
  font-size:48px;
  opacity:.7;
}

.puzzle-piece{
  position:absolute;
  border-radius:12px;
  border:1px solid rgba(0,0,0,.06);
  box-shadow:0 10px 22px rgba(0,0,0,.14);
  cursor:grab;
  transition:transform .1s ease, box-shadow .2s ease;
  z-index:10;
  background-size:cover;
  touch-action:none;
}

.puzzle-piece.moving{
  transform:scale(1.05);
  box-shadow:0 18px 44px rgba(0,0,0,.22);
  z-index:100;
  cursor:grabbing;
}

.puzzle-piece.correct{
  box-shadow:0 0 0 3px rgba(182,244,0,.65), 0 12px 26px rgba(0,0,0,.14);
}

.snap-effect{ animation:snap .28s ease; }
@keyframes snap{
  0%{ transform:scale(1.08); }
  70%{ transform:scale(.98); }
  100%{ transform:scale(1); }
}

.controls{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:12px;
  flex-wrap:wrap;
}

.modal{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  z-index:2000;
  align-items:center;
  justify-content:center;
  padding:18px;
}

.modal-content{
  width:min(520px, 100%);
  background:var(--card);
  border-radius:22px;
  box-shadow:0 24px 70px rgba(0,0,0,.35);
  border:1px solid rgba(255,255,255,.16);
  padding:22px;
  text-align:center;
}

.modal-content h2{
  margin:0 0 10px;
  font-size:28px;
}

.modal-content p{
  margin:10px 0;
  color:var(--muted);
  line-height:1.45;
}

.big-score{
  font-size:34px;
  font-weight:1000;
  margin-top:6px;
  color:#111;
}

.completion-effect{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:1000;
  opacity:0;
}

.confetti{
  position:absolute;
  width:12px;
  height:12px;
  opacity:0;
  border-radius:4px;
}

@media (max-width: 920px){
  .grid{ grid-template-columns:1fr; }
  .puzzle-container{ height:520px; }
}
@media (max-width: 720px){
  .shell{ padding:24px 18px 18px; }
  .h1{ font-size:30px; }
  .tab{ width:100%; text-align:center; }
  .stats{ grid-template-columns: 1fr; }
  .puzzle-container{ height:440px; }
}
