:root{
  --page-bg:#eef4f8;
  --paper:#ffffff;
  --ink:#24333f;
  --muted:#667783;
  --line:#d6e3e8;
  --teal:#13b8bf;
  --teal-dark:#0b8d99;
  --purple:#752df0;
  --purple-dark:#5420b7;
  --navy:#30377f;
  --blue:#1877f2;
  --blue-dark:#0a4db5;
  --orange:#ff7b2c;
  --orange-dark:#c84d0c;
  --green:#25a866;
  --green-dark:#147641;
  --pink:#f33d77;
  --pink-dark:#bd1550;
  --success:#38b66b;
  --warning:#ffb52f;
  --danger:#ff5c68;
}

*{box-sizing:border-box}
html{min-height:100%}
body{
  min-height:100vh;margin:0;padding:8px 10px;color:var(--ink);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:
    radial-gradient(circle at 8% 12%,rgba(117,45,240,.08),transparent 24%),
    radial-gradient(circle at 92% 84%,rgba(19,184,191,.10),transparent 28%),
    var(--page-bg);
}
button{font:inherit}
button:focus-visible{outline:3px solid rgba(117,45,240,.32);outline-offset:2px}

.game-app{
  width:min(100%,1140px);margin:0 auto;padding:8px;
  border:1px solid #dce8ec;border-radius:24px;background:rgba(255,255,255,.9);
  box-shadow:0 18px 55px rgba(31,69,82,.12)
}
.workspace{
  display:grid;
  grid-template-columns:minmax(0,min(700px,calc(100vh - 44px))) minmax(310px,360px);
  justify-content:center;align-items:start;gap:10px
}
.game-column{width:100%;max-width:min(700px,calc(100vh - 44px));min-width:0}
.control-column{min-width:0;display:grid;gap:7px;align-content:start}

.control-panel,.status-card,.meti-panel,.session-card{
  border:1px solid var(--line);border-radius:19px;background:rgba(255,255,255,.96);
  box-shadow:0 8px 22px rgba(38,76,91,.06)
}
.control-panel{padding:8px;display:grid;gap:7px}
.setting-block{padding:7px;border:1px solid var(--line);border-radius:14px;background:#f9fcfd}
.setting-label,.small-label{display:block;color:#526975;font-size:.68rem;font-weight:850}
.setting-label{margin-bottom:5px}

.difficulty-list{display:grid;gap:5px}
.difficulty-button{
  min-height:46px;padding:6px 9px;display:grid;grid-template-columns:26px minmax(0,1fr);align-items:center;gap:8px;
  border:1px solid #d5e1e5;border-radius:13px;color:#334754;background:#f5f9fb;cursor:pointer;text-align:left;
  transition:transform .15s ease,box-shadow .15s ease,border-color .15s ease,background .15s ease
}
.difficulty-button strong,.difficulty-button small{display:block}
.difficulty-button strong{font-size:.79rem}
.difficulty-button small{margin-top:1px;color:#73848e;font-size:.60rem}
.difficulty-button.active{
  border-color:#9c63fa;background:linear-gradient(180deg,#fff,#f7f0ff);
  box-shadow:0 0 0 3px rgba(117,45,240,.08),0 7px 15px rgba(92,45,163,.10)
}
.level-dot{
  width:22px;height:22px;border:3px solid rgba(255,255,255,.9);border-radius:50%;
  box-shadow:0 4px 10px rgba(27,52,66,.15)
}
.easy-dot{background:#63d646}.medium-dot{background:#ffad2f}.hard-dot{background:#ff5c68}

.new-game-button,.primary-action,.primary-button,.hint-button{
  min-height:42px;border:0;border-radius:13px;color:#fff;cursor:pointer;font-weight:950
}
.new-game-button,.primary-action{
  background:linear-gradient(135deg,#20c0c6,#0d91a2);
  box-shadow:inset 0 -4px 0 rgba(0,75,86,.20),0 7px 15px rgba(13,145,162,.18)
}
.primary-button{width:100%;background:linear-gradient(135deg,#7d35f4,#5b1dc7)}
.hint-button{
  width:100%;min-height:40px;margin-top:8px;color:#51327d;border:1px solid #e1d3fb;
  background:linear-gradient(180deg,#fff,#f7f0ff);box-shadow:0 5px 12px rgba(104,61,162,.07)
}
.new-game-button:active,.primary-action:active,.primary-button:active,.hint-button:active,
.secondary-action:active,.difficulty-button:active,.operation-button:active,.number-tile:active{transform:scale(.98)}

.game-board{
  position:relative;width:100%;aspect-ratio:1;min-height:560px;padding:clamp(14px,2vw,22px);
  display:flex;flex-direction:column;gap:12px;overflow:hidden;border:5px solid #245563;border-radius:29px;
  background:
    radial-gradient(circle at 12% 18%,rgba(117,45,240,.06),transparent 20%),
    radial-gradient(circle at 86% 74%,rgba(19,184,191,.09),transparent 24%),
    linear-gradient(180deg,#fafdff 0%,#edf7fa 100%);
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.85),0 20px 38px rgba(33,65,73,.18)
}
.game-board:after{
  content:"";position:absolute;left:0;right:0;bottom:0;height:8px;
  background:linear-gradient(90deg,var(--purple),var(--teal),var(--orange),var(--pink))
}
.game-board>*{position:relative;z-index:1}

.target-zone{
  position:relative;min-height:128px;display:grid;place-items:center;align-content:center;overflow:hidden;
  border:2px solid rgba(255,255,255,.28);border-radius:24px;color:#fff;
  background:
    radial-gradient(circle at 76% 16%,rgba(255,255,255,.25),transparent 18%),
    linear-gradient(120deg,#4b3b96 0%,#7025ea 56%,#962dea 100%);
  box-shadow:inset 0 -7px 0 rgba(57,16,119,.18),inset 0 2px 0 rgba(255,255,255,.24),0 10px 20px rgba(70,34,139,.20)
}
.target-zone:before{
  content:"";position:absolute;width:190px;height:190px;left:-65px;bottom:-105px;border-radius:50%;
  border:28px solid rgba(19,184,191,.22)
}
.target-label{font-size:.74rem;font-weight:1000;letter-spacing:.14em}
.target-number{
  margin:-3px 0;font-size:clamp(3.2rem,8vw,5.35rem);line-height:1;letter-spacing:-.055em;
  text-shadow:0 5px 0 rgba(42,17,92,.18),0 8px 20px rgba(25,8,59,.20)
}
.target-caption{font-size:.72rem;font-weight:900;color:#f2eaff}
.target-meta{
  position:absolute;right:13px;bottom:11px;padding:5px 9px;border-radius:999px;
  background:rgba(29,19,75,.26);font-size:.65rem;font-weight:900
}
.target-spark{position:absolute;color:#ffe36a;opacity:.9;text-shadow:0 2px 8px rgba(255,226,79,.35)}
.spark-one{top:20px;left:24px;font-size:1.25rem;transform:rotate(-12deg)}
.spark-two{right:28px;top:23px;font-size:.9rem;transform:rotate(18deg)}

.numbers-zone{
  padding:12px 13px 15px;border:1px solid #dbe8ed;border-radius:20px;background:#fff;
  box-shadow:0 8px 18px rgba(32,74,89,.10)
}
.zone-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}
.zone-title{margin:0;color:#3b5663;font-size:.74rem;font-weight:950}
.zone-help{color:#81939c;font-size:.62rem;font-weight:800}
.number-tiles{min-height:84px;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:11px}

.number-tile{
  position:relative;min-width:76px;height:72px;padding:0 14px;border:3px solid #0f54b9;border-radius:17px;color:#fff;
  background:linear-gradient(150deg,#2987ff 0%,#1468e7 58%,#1058c9 100%);
  box-shadow:inset 0 -8px 0 rgba(7,55,137,.24),inset 0 3px 0 rgba(255,255,255,.22),0 7px 13px rgba(21,91,190,.20);
  cursor:pointer;font-size:1.7rem;font-weight:1000;text-shadow:0 2px 0 rgba(0,46,111,.18);
  transition:transform .15s ease,filter .15s ease,box-shadow .15s ease
}
.number-tile:nth-child(4n+2){background:linear-gradient(150deg,#6577ff,#4f5ce0);border-color:#3c47b8}
.number-tile:nth-child(4n+3){background:linear-gradient(150deg,#0fb8c6,#0a98aa);border-color:#087c8b}
.number-tile:nth-child(4n+4){background:linear-gradient(150deg,#7b4ae9,#6433cd);border-color:#4d24a8}
.number-tile:hover{transform:translateY(-3px) scale(1.02);filter:saturate(1.12)}
.number-tile.selected{
  color:#fff;border-color:#ffdb42;background:linear-gradient(150deg,#8750ff,#6b2ce4);
  box-shadow:0 0 0 5px rgba(255,218,67,.24),inset 0 -8px 0 rgba(63,19,138,.22),0 10px 18px rgba(87,46,160,.22)
}
.number-tile.first-selected:after{
  content:"1";position:absolute;right:-7px;top:-8px;width:24px;height:24px;display:grid;place-items:center;
  border:2px solid #fff;border-radius:50%;color:#fff;background:#ffb226;font-size:.67rem;font-weight:1000;box-shadow:0 3px 7px rgba(96,57,0,.18)
}
.number-tile.result-tile{
  border-color:#079190;background:linear-gradient(150deg,#20d0c6,#0aa9a9);
  box-shadow:inset 0 -8px 0 rgba(0,112,113,.22),inset 0 3px 0 rgba(255,255,255,.22),0 8px 15px rgba(3,145,148,.20)
}
.number-tile.pop{animation:tilePop .32s ease}

.expression-zone{min-height:58px;display:flex;align-items:center;justify-content:center;gap:10px}
.expression-value,.expression-operator{
  min-width:76px;min-height:52px;padding:8px 12px;display:grid;place-items:center;border-radius:15px;font-size:1.22rem;font-weight:1000
}
.expression-value{
  color:#2b4050;background:#fff;border:2px solid #d5e3e8;box-shadow:0 5px 12px rgba(42,78,91,.08)
}
.expression-value.placeholder{color:#a9b7bd}
.expression-operator{
  min-width:56px;color:#fff;background:linear-gradient(145deg,#3a4870,#273453);
  box-shadow:inset 0 -4px 0 rgba(12,23,47,.22)
}

.operations-zone{display:grid;grid-template-columns:repeat(4,1fr);gap:9px}
.operation-button{
  min-height:62px;padding:6px 4px 7px;border:3px solid rgba(0,0,0,.12);border-radius:15px;color:#fff;cursor:pointer;
  display:grid;place-items:center;align-content:center;transition:transform .15s ease,filter .15s ease,box-shadow .15s ease
}
.operation-button span{font-size:2rem;line-height:1;font-weight:1000;text-shadow:0 2px 0 rgba(0,0,0,.12)}
.op-plus{background:linear-gradient(145deg,#9b65df,#7b45c4);border-color:#6c39ad;box-shadow:inset 0 -7px 0 rgba(80,35,135,.26),0 6px 12px rgba(123,69,196,.20)}
.op-minus{background:linear-gradient(145deg,#ff8245,#ff6227);border-color:#d74911;box-shadow:inset 0 -7px 0 rgba(183,54,7,.25),0 6px 12px rgba(255,98,39,.18)}
.op-times{background:linear-gradient(145deg,#3ab575,#24955c);border-color:#1c7548;box-shadow:inset 0 -7px 0 rgba(18,100,59,.24),0 6px 12px rgba(36,149,92,.18)}
.op-divide{background:linear-gradient(145deg,#ff4f82,#ed2e68);border-color:#c51c52;box-shadow:inset 0 -7px 0 rgba(168,18,67,.24),0 6px 12px rgba(237,46,104,.18)}
.operation-button:not(:disabled):hover{transform:translateY(-3px);filter:saturate(1.12) brightness(1.03)}
.operation-button.active{
  border-color:#ffde56;transform:translateY(-3px);box-shadow:0 0 0 5px rgba(255,221,78,.28),inset 0 -7px 0 rgba(0,0,0,.16),0 9px 16px rgba(45,55,70,.18)
}
.operation-button:disabled{cursor:not-allowed;filter:grayscale(.58);opacity:.42;box-shadow:none}

.feedback-line{
  min-height:40px;padding:9px 12px;display:grid;place-items:center;border:1px solid #d6e5ec;border-radius:13px;
  color:#38515d;background:linear-gradient(180deg,#f7fbfd,#eef7fa);font-size:.78rem;font-weight:850;text-align:center
}
.feedback-line.success{color:#17633a;border-color:#a9e1bd;background:#eafaf0}
.feedback-line.warning{color:#79530e;border-color:#f3d795;background:#fff7df}

.history-card{padding:10px 12px;border:1px solid #d9e6eb;border-radius:16px;background:#fff}
.history-head{display:flex;justify-content:space-between;gap:10px;color:#526b77;font-size:.69rem;font-weight:900}
.history-head strong{color:#344b56}
.history-list{min-height:26px;margin-top:7px;display:flex;gap:7px;overflow:hidden}
.history-chip{
  flex:0 0 auto;padding:6px 9px;border:1px solid #cfe0e5;border-radius:10px;color:#344d57;background:#f2f8fa;font-size:.67rem;font-weight:900
}
.history-empty{color:#91a2aa;font-size:.68rem}

.board-actions{display:grid;grid-template-columns:1fr 1fr 1.12fr;gap:8px;margin-top:auto}
.secondary-action{
  min-height:43px;border:1px solid #c5d8df;border-radius:13px;color:#435c68;background:#fff;cursor:pointer;font-weight:950;
  box-shadow:inset 0 -3px 0 rgba(111,137,147,.08),0 4px 10px rgba(44,78,90,.06)
}
.secondary-action:disabled{opacity:.38;cursor:not-allowed}

.status-card{padding:9px 10px}
.stat-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
.stat-item{
  min-width:0;padding:8px;display:flex;align-items:center;gap:6px;border:1px solid #dce7ea;border-radius:13px;background:#fbfdfe
}
.stat-icon{font-size:1.02rem}
.stat-item strong{display:block;margin-top:1px;font-size:.88rem}
.score-stat{background:#fffaf0}.streak-stat{background:#fff7f2}.target-stat{background:#f4f9ff}

.progress-block{margin-top:8px;padding:8px 9px;border:1px solid #dce8ed;border-radius:13px;background:#f9fcfd}
.progress-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:7px;color:#667b85;font-size:.62rem;font-weight:900}
.progress-head strong{color:#6240a7}
.progress-track{display:grid;grid-template-columns:repeat(8,1fr);gap:4px}
.progress-step{
  height:12px;border-radius:999px;background:#dce8ed;box-shadow:inset 0 1px 2px rgba(34,67,78,.08);transition:.2s ease
}
.progress-step.done{background:linear-gradient(90deg,#18b8c0,#24cfaa)}
.progress-step.current{background:linear-gradient(90deg,#7e35f3,#a54cf1);box-shadow:0 0 0 3px rgba(126,53,243,.12)}

.meti-panel{
  min-height:108px;padding:8px 10px;display:grid;grid-template-columns:78px minmax(0,1fr);align-items:center;gap:8px;
  overflow:hidden;background:linear-gradient(135deg,#fff 0%,#fbf7ff 100%)
}
.meti-image-wrap{display:flex;align-items:center;justify-content:center;min-height:78px}
.meti-image{display:block;width:100%;max-width:74px;max-height:86px;object-fit:contain;filter:drop-shadow(0 8px 12px rgba(91,50,143,.15))}
.meti-bubble{
  position:relative;min-width:0;padding:11px 13px;border-radius:16px;color:#fff;
  background:linear-gradient(135deg,#343b8d,#6338b3);box-shadow:inset 0 1px 0 rgba(255,255,255,.12)
}
.meti-bubble:before{content:"";position:absolute;left:-7px;top:36%;width:14px;height:14px;background:#3a3d90;transform:rotate(45deg)}
.meti-bubble strong{display:block;margin-bottom:3px;font-size:.82rem}
.meti-bubble p{margin:0;font-size:.67rem;line-height:1.38}

.session-card{padding:7px;display:grid;grid-template-columns:1fr 1fr;gap:6px}
.session-card>div{padding:8px 9px;border:1px solid #dce7ea;border-radius:13px;background:#fbfdfe}
.session-card span{display:block;margin-bottom:3px;color:#5c7180;font-size:.68rem}
.session-card strong{display:block;font-size:.80rem}

.confetti-piece{
  position:absolute;z-index:6;top:18%;left:50%;width:9px;height:14px;border-radius:3px;pointer-events:none;
  animation:confettiFall 950ms cubic-bezier(.14,.68,.35,1) forwards
}

.modal{
  position:fixed;inset:0;z-index:30;display:grid;place-items:center;padding:20px;visibility:hidden;opacity:0;transition:.18s ease
}
.modal.open{visibility:visible;opacity:1}
.modal-backdrop{position:absolute;inset:0;background:rgba(26,30,35,.56);backdrop-filter:blur(6px)}
.modal-card{
  position:relative;z-index:1;width:min(100%,470px);max-height:min(88vh,720px);overflow:auto;padding:24px;
  border:1px solid rgba(255,255,255,.85);border-radius:25px;background:#fff;box-shadow:0 24px 70px rgba(31,45,53,.24)
}
.result-card{text-align:center}
.result-meti-image{width:136px;height:120px;object-fit:contain;margin:0 auto 6px;display:block}
.result-eyebrow{margin:0 0 5px;color:var(--purple);font-size:.68rem;font-weight:1000;letter-spacing:.12em}
.result-card h2{margin:0 0 8px;font-size:1.72rem}
.result-card>p:not(.result-eyebrow){color:#637480}
.result-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin:15px 0}
.result-stats div{padding:10px 7px;border:1px solid var(--line);border-radius:13px;background:#fbfdfe}
.result-stats span{display:block;color:#667783;font-size:.66rem;font-weight:850}
.result-stats strong{display:block;margin-top:3px;font-size:1rem}
.result-meti-text{margin:10px 0 16px;padding:10px 12px;border-radius:14px;background:#f5f2ff;color:#3a3d79!important;font-size:.82rem;line-height:1.45}

@keyframes tilePop{
  0%{transform:scale(.72) rotate(-3deg);opacity:.25}
  68%{transform:scale(1.09) rotate(1deg)}
  100%{transform:scale(1);opacity:1}
}
@keyframes confettiFall{
  0%{transform:translate(0,-15px) rotate(0);opacity:1}
  100%{transform:translate(var(--x),280px) rotate(var(--r));opacity:0}
}

@media (min-width:901px){
  .difficulty-list{grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}
  .difficulty-button{min-height:55px;padding:5px 3px;grid-template-columns:1fr;justify-items:center;gap:3px;text-align:center}
  .difficulty-button strong{font-size:.66rem;line-height:1.12;white-space:nowrap}
  .difficulty-button small{display:none}
  .difficulty-button .level-dot{width:18px;height:18px;border-width:2px}
  .control-panel{gap:6px;padding:7px}.setting-block{padding:6px}.new-game-button{min-height:39px}
  .meti-panel{min-height:94px;padding:7px 9px;grid-template-columns:68px minmax(0,1fr);gap:7px}
  .meti-image-wrap{min-height:68px}.meti-image{max-width:64px;max-height:73px}
  .meti-bubble{padding:10px 11px}.meti-bubble strong{font-size:.79rem}.meti-bubble p{font-size:.64rem;line-height:1.32}
}
@media (min-width:901px) and (max-height:780px){
  .workspace{grid-template-columns:minmax(0,min(650px,calc(100vh - 36px))) minmax(300px,340px);gap:8px}
  .game-column{max-width:min(650px,calc(100vh - 36px))}
  .game-board{min-height:0;gap:9px;padding:14px}.target-zone{min-height:104px}
  .numbers-zone{padding:9px 10px 11px}.number-tiles{min-height:66px}.number-tile{height:60px;min-width:66px;font-size:1.45rem}
  .expression-zone{min-height:48px}.expression-value,.expression-operator{min-height:45px}
  .operation-button{min-height:52px}.operation-button span{font-size:1.55rem}
  .history-card{padding:8px 10px}.difficulty-button{min-height:46px}.meti-panel{min-height:80px}
  .target-caption{display:none}
}
@media(max-width:900px){
  .workspace{display:flex!important;flex-direction:column!important;gap:10px!important}
  .control-column{display:contents!important}.control-panel{order:1;width:100%}.game-column{order:2;width:100%;max-width:none}
  .status-card{order:3;width:100%}.meti-panel{order:4;width:100%}.session-card{order:5;width:100%}
  .game-board{aspect-ratio:auto;min-height:650px}
}
@media(max-width:680px){
  body{padding:7px}.game-app{padding:8px;border-radius:20px}.game-board{padding:12px;min-height:620px;border-radius:24px}
  /* Mobilde hedef sayının üzerine taşan dekoratif renk halkasını kaldır.
     Masaüstü görünümündeki tasarım aynen korunur. */
  .target-zone:before{display:none}
  .target-zone{min-height:112px}.zone-help{display:none}.number-tile{min-width:65px;height:62px;font-size:1.4rem}
  .meti-panel{grid-template-columns:92px minmax(0,1fr);min-height:126px;padding:12px}.meti-image{max-width:86px;max-height:96px}.meti-image-wrap{min-height:90px}
}
@media(max-width:440px){
  .game-board{gap:9px;border-width:4px}.number-tiles{gap:7px}.number-tile{min-width:58px;height:58px;padding:0 10px;font-size:1.25rem}
  .expression-value{min-width:62px}.operations-zone{gap:6px}.operation-button{min-height:54px}  .board-actions{grid-template-columns:1fr 1fr}.primary-action{grid-column:1/-1}.stat-grid{gap:4px}
  .stat-item{padding:7px 5px;gap:4px}.stat-icon{font-size:.88rem}
  .meti-panel{grid-template-columns:76px minmax(0,1fr);gap:8px}.meti-bubble{padding:12px}.meti-bubble strong{font-size:.83rem}.meti-bubble p{font-size:.69rem}
}
@media(prefers-reduced-motion:reduce){
  *,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}
