*{box-sizing:border-box}

:root{
  --navy:#10275d;
  --navy2:#0a1d49;
  --blue:#5b8fe8;
  --purple:#7446d9;
  --ink:#17305f;
  --green:#22bd7b;
  --line:#d8e3f5;
}

html,body{
  margin:0;
  width:100%;
  height:100%;
  overflow:hidden;
  font-family:"Trebuchet MS","Segoe UI",Arial,sans-serif;
  color:var(--ink);
}

body{
  background:
    radial-gradient(circle at 84% 20%,rgba(100,119,220,.24),transparent 23%),
    linear-gradient(135deg,#112b67 0%,#1c438b 100%);
}

button{font:inherit}

.game-shell{
  width:100%;
  height:100vh;
  display:flex;
  flex-direction:column;
}

.topbar{
  height:66px;
  flex:0 0 66px;
  display:flex;
  align-items:center;
  gap:18px;
  padding:0 22px;
  color:#fff;
  background:rgba(7,22,63,.86);
  border-bottom:1px solid rgba(255,255,255,.12);
}

.brand{
  display:flex;
  align-items:center;
  gap:9px;
  font-size:27px;
  font-weight:900;
  white-space:nowrap;
}

.brand-dot{
  width:15px;
  height:15px;
  border-radius:50%;
  background:#8d51ff;
  box-shadow:0 0 14px rgba(141,81,255,.75);
}

.game-name{
  padding:9px 18px;
  border-radius:12px;
  background:#1c3979;
  font-weight:800;
  font-size:17px;
}

.top-stats{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:9px;
}

.stat-pill{
  min-height:40px;
  display:flex;
  align-items:center;
  gap:6px;
  padding:0 13px;
  border-radius:13px;
  background:#193674;
  color:#fff;
  white-space:nowrap;
  font-size:14px;
}

.progress-wrap{
  display:flex;
  align-items:center;
  gap:7px;
  color:#aee1ff;
}

.progress{
  width:125px;
  height:10px;
  background:#385388;
  border-radius:20px;
  overflow:hidden;
}

.progress span{
  display:block;
  height:100%;
  width:12.5%;
  background:#4ed394;
  border-radius:20px;
  transition:width .25s;
}

.reset-game{
  width:40px;
  height:40px;
  border:1px solid rgba(255,255,255,.25);
  border-radius:13px;
  background:#17346e;
  color:#fff;
  font-size:24px;
  cursor:pointer;
}

.game-main{
  flex:1;
  min-height:0;
  width:min(1320px,100%);
  margin:0 auto;
  padding:14px 22px 12px;
  display:flex;
  flex-direction:column;
  gap:10px;
  overflow:hidden;
}

.boards{
  flex:0 0 min(66vh, 610px);
  min-height:0;
  display:grid;
  grid-template-columns:minmax(0,1fr) 42px minmax(0,1fr);
  align-items:center;
  gap:10px;
}

.board-card{
  height:100%;
  min-height:0;
  background:#f9fbff;
  border-radius:19px;
  padding:11px;
  box-shadow:0 13px 30px rgba(0,0,0,.18);
  display:flex;
  flex-direction:column;
}

.board-title{
  flex:0 0 auto;
  text-align:center;
  font-weight:900;
  font-size:17px;
  padding:8px;
  border-radius:11px;
  margin-bottom:8px;
}

.board-title.blue{background:#dce9ff}
.board-title.green{background:#d8f4e8}

.grid{
  flex:0 0 auto;
  height:calc(100% - 46px);
  width:auto;
  aspect-ratio:1 / 1;
  max-width:100%;
  margin:auto;
  display:grid;
  grid-template-columns:repeat(7,minmax(0,1fr));
  grid-template-rows:repeat(7,minmax(0,1fr));
  background-image:
    linear-gradient(#dfe7f4 1px,transparent 1px),
    linear-gradient(90deg,#dfe7f4 1px,transparent 1px);
  background-size:14.2857% 14.2857%;
  border:2px solid #e0e7f3;
  border-radius:12px;
  overflow:hidden;
  background-color:#fcfdff;
}

.cell{position:relative}

.cell.shape-start{
  background:linear-gradient(145deg,#8b5be5,#683dca);
  border:2px solid #4f2ca1;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.35);
}

.cell.shape-target{
  background:linear-gradient(145deg,#42cda0,#14aa77);
  border:2px solid #087e5b;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.35);
}

.middle-arrow{
  color:#9bc1ff;
  font-size:38px;
  text-align:center;
  font-weight:900;
}

.control-area{
  flex:0 0 auto;
  position:relative;
  z-index:2;
}

.instruction{
  min-height:34px;
  display:flex;
  align-items:center;
  gap:10px;
  color:#fff;
  margin-bottom:8px;
}

.instruction>span{
  font-size:28px;
}

.instruction strong{
  display:block;
  font-size:16px;
}

.instruction small{
  display:block;
  margin-top:2px;
  color:#d9e6ff;
  font-size:12px;
}

.controls-card{
  display:grid;
  grid-template-columns:repeat(6,1fr);
  gap:8px;
  background:#f4f7fd;
  border-radius:17px;
  padding:9px;
  box-shadow:0 10px 25px rgba(0,0,0,.16);
}

.action-btn{
  min-height:68px;
  border:2px solid #d9e3f4;
  border-radius:13px;
  background:#fff;
  color:#17366f;
  cursor:pointer;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:1px;
  transition:.12s;
}

.action-btn:hover{
  transform:translateY(-2px);
  border-color:#9db9eb;
  box-shadow:0 6px 13px rgba(31,73,145,.12);
}

.action-btn:active{transform:scale(.98)}

.action-icon{
  color:#2363b8;
  font-size:25px;
  line-height:1;
}

.action-btn b{font-size:12px}
.action-btn small{font-size:10px;color:#7182a0}
.action-btn.undo{background:#f4f7fc}
.action-btn.reset-level{background:#eef2f8}

.bottom-row{
  display:flex;
  align-items:center;
  gap:12px;
  margin-top:8px;
}

.move-info{
  display:flex;
  gap:7px;
  align-items:center;
  color:#e2ebff;
  font-size:12px;
  white-space:nowrap;
}

.move-info b{color:#ffd35c}

.hint{
  flex:1;
  color:#dce8ff;
  font-size:12px;
  text-align:right;
}

.overlay{
  position:fixed;
  inset:0;
  z-index:20;
  display:grid;
  place-items:center;
  background:rgba(5,15,43,.74);
  padding:18px;
}

.overlay.hidden{display:none}

.success-modal{
  width:min(650px,94vw);
  display:flex;
  align-items:center;
  gap:25px;
  padding:28px;
  border-radius:24px;
  background:#fff;
  box-shadow:0 28px 70px rgba(0,0,0,.38);
}

.success-icon{
  width:125px;
  height:125px;
  flex:0 0 125px;
  display:grid;
  place-items:center;
  border-radius:50%;
  background:#e7f8ef;
  font-size:58px;
}

.stars{
  font-size:22px;
  letter-spacing:3px;
}

.success-modal h2{
  margin:5px 0 5px;
  color:#214d93;
  font-size:30px;
}

.success-modal p{
  margin:0 0 13px;
  color:#607394;
  line-height:1.4;
}

.result-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:7px;
  margin-bottom:14px;
}

.result-grid div{
  padding:9px;
  border-radius:11px;
  background:#f1f5fc;
  text-align:center;
}

.result-grid small{
  display:block;
  color:#71809a;
  font-size:10px;
}

.result-grid b{
  display:block;
  color:#204c92;
  font-size:18px;
  margin-top:2px;
}

.next-btn{
  border:0;
  border-radius:13px;
  padding:12px 20px;
  background:#20bd78;
  color:#fff;
  font-weight:900;
  cursor:pointer;
}

.shake{animation:shake .3s}
@keyframes shake{
  25%{transform:translateX(-5px)}
  50%{transform:translateX(5px)}
  75%{transform:translateX(-3px)}
}

@media(max-width:900px){
  html,body{overflow:auto}
  .game-shell{height:auto;min-height:100vh}
  .topbar{height:auto;min-height:62px;flex-wrap:wrap;padding:9px 12px}
  .top-stats{margin-left:0;width:100%;overflow:auto}
  .game-main{padding:12px}
  .boards{grid-template-columns:1fr;gap:5px}
  .middle-arrow{transform:rotate(90deg);height:22px;font-size:27px}
  .board-card{height:auto}
  .grid{width:min(72vw,420px);height:auto;aspect-ratio:1}
  .controls-card{grid-template-columns:repeat(3,1fr)}
  .bottom-row{flex-direction:column;align-items:flex-start}
  .hint{text-align:left}
}

@media(max-width:520px){
  .brand{font-size:22px}
  .game-name{display:none}
  .stat-pill{padding:0 9px;font-size:12px}
  .progress{width:80px}
  .controls-card{grid-template-columns:repeat(2,1fr)}
  .success-modal{flex-direction:column;text-align:center}
}


/* Doğru hamleden sonra şeklin hareket ettiğini hissettiren geçiş */
.solution-motion{
  animation: boardMove .85s cubic-bezier(.2,.8,.2,1);
}

.target-pulse{
  animation: targetPulse .45s ease-out;
}

@keyframes boardMove{
  0%{transform:scale(1);filter:brightness(1)}
  35%{transform:scale(1.025);filter:brightness(1.12)}
  70%{transform:scale(.985);filter:brightness(1.05)}
  100%{transform:scale(1);filter:brightness(1)}
}

@keyframes targetPulse{
  0%{transform:scale(1)}
  50%{transform:scale(1.018);filter:brightness(1.12)}
  100%{transform:scale(1);filter:brightness(1)}
}





@media (max-height:760px) and (min-width:901px){
  .boards{flex-basis:min(60vh,500px)}
  .topbar{height:58px;flex-basis:58px}
  .game-main{padding-top:8px;gap:7px}
  .instruction{min-height:28px}
  .controls-card{padding:6px}
  .action-btn{min-height:58px}
}

@media (max-height:650px) and (min-width:901px){
  .boards{flex-basis:min(55vh,430px)}
  .action-btn{min-height:52px}
  .action-icon{font-size:21px}
  .instruction small{font-size:10px}
}


/* -------------------------------------------------------
   GERÇEK ŞEKİL DÖNÜŞÜM ANİMASYONU
   Bütün parçalar tek bir grup olarak hareket eder.
------------------------------------------------------- */
.shape-animation-group{
  position:absolute;
  inset:0;
  z-index:30;
  pointer-events:none;
  overflow:hidden;
  transform-origin:50% 50%;
  transition:transform .5s cubic-bezier(.22,.75,.2,1);
  will-change:transform;
}

.animated-tile{
  position:absolute;
  box-sizing:border-box;
  border:2px solid #4f2ca1;
  border-radius:0;
  background:linear-gradient(145deg,#8b5be5,#683dca);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.4),
    0 5px 14px rgba(62,31,145,.20);
}


/* 7x7 oyun tahtası her zaman tam kare:
   hücre genişliği = hücre yüksekliği */
.grid{
  min-width:0;
  min-height:0;
}

/* Mobilde genişlik sınırlaması daha kullanışlıdır. */
@media(max-width:900px){
  .grid{
    width:min(72vw, 420px);
    height:auto;
    aspect-ratio:1 / 1;
  }
}
