/* =========================================================
   Kelime Yörüngesi — style.css
   Kimlik: gece yörüngesi. Derin indigo gece, sıcak kayısı ışık,
   nane yeşili onay. Harf taşları bir gezegenin çevresinde döner.
   ========================================================= */

:root {
  --night: #0C1230;
  --night-2: #131A3E;
  --panel: rgba(255, 255, 255, .06);
  --panel-2: rgba(255, 255, 255, .10);
  --line: rgba(255, 255, 255, .14);
  --ink: #EDF1FF;
  --dim: #98A3D4;
  --gold: #FFB86B;
  --gold-soft: #FFD9A0;
  --mint: #6BE3B0;
  --rose: #FF7A8A;
  --violet: #B9A6FF;

  --font-display: ui-rounded, "SF Pro Rounded", "Segoe UI Variable Display", Nunito, "Trebuchet MS", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --r-lg: 26px;
  --r-md: 16px;
  --r-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(120% 70% at 50% -10%, #1E2A62 0%, transparent 60%),
    linear-gradient(180deg, var(--night) 0%, var(--night-2) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------- iskelet ---------------- */

.app {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------------- üst bar ---------------- */

.hud {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--dim);
  transition: background .18s ease, color .18s ease;
}
.icon-btn:active { background: var(--panel-2); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.is-off { color: #5D6796; }
.icon-btn.is-off .wave { opacity: 0; }

.hud-title { flex: 1 1 auto; min-width: 0; text-align: center; }

.eyebrow {
  display: block;
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: .85;
}

.hud-title h1 {
  margin: 1px 0 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

.stat {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
}
.stat::before {
  content: "";
  width: 9px; height: 9px;
  border-radius: 50%;
}
.stat--coin { color: var(--gold); }
.stat--coin::before { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.stat--score { color: var(--violet); }
.stat--score::before { background: var(--violet); box-shadow: 0 0 8px var(--violet); }

/* ---------------- sahne (küçük dünya) ---------------- */

.scene {
  position: relative;
  flex: 1 1 auto;
  min-height: 118px;
  max-height: 32vh;
  margin: 0 10px;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px -24px #000;
}

.ky-scene-svg { display: block; width: 100%; height: 100%; }

.kp {
  opacity: 0;
  transform: scale(.55) translateY(6px);
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: opacity .55s ease, transform .8s cubic-bezier(.2, 1.5, .4, 1);
}
.kp.kp-c { transform-origin: 50% 50%; transform: scale(.2) rotate(-40deg); }
.kp.on { opacity: 1; transform: none; }
.kp.on .ky-spin { animation: ky-spin 7s linear infinite; transform-box: fill-box; transform-origin: 50% 50%; }

@keyframes ky-spin { to { transform: rotate(360deg); } }

.scene.flash::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 60% at 50% 100%, rgba(255, 216, 160, .38), transparent 70%);
  animation: ky-flash .7s ease-out forwards;
  pointer-events: none;
}
@keyframes ky-flash { from { opacity: 1; } to { opacity: 0; } }

/* ---------------- ilerleme şeridi ---------------- */

.ribbon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 6px;
}

.track {
  flex: 1 1 auto;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .10);
  overflow: hidden;
}
.track i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--mint), var(--gold));
  transition: width .5s cubic-bezier(.2, .9, .3, 1);
}

.ribbon-text {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: .01em;
}

/* ---------------- kelime yuvaları ---------------- */

.slots {
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 6px 10px;
  padding: 4px 12px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.slot { display: inline-flex; gap: 3px; }

.cell {
  width: clamp(19px, 6.2vw, 27px);
  height: clamp(24px, 7.6vw, 33px);
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .09);
  font-family: var(--font-display);
  font-size: clamp(13px, 4vw, 17px);
  font-weight: 800;
  color: transparent;
  transition: background .3s ease, color .3s ease, border-color .3s ease;
}

.slot.found .cell {
  background: linear-gradient(180deg, rgba(107, 227, 176, .22), rgba(107, 227, 176, .10));
  border-color: rgba(107, 227, 176, .45);
  color: var(--ink);
}
.slot.found .cell { animation: ky-pop .42s cubic-bezier(.2, 1.6, .4, 1) both; }
.slot.found .cell:nth-child(2) { animation-delay: .05s; }
.slot.found .cell:nth-child(3) { animation-delay: .10s; }
.slot.found .cell:nth-child(4) { animation-delay: .15s; }
.slot.found .cell:nth-child(5) { animation-delay: .20s; }
.slot.found .cell:nth-child(6) { animation-delay: .25s; }
.slot.found .cell:nth-child(7) { animation-delay: .30s; }

@keyframes ky-pop {
  0% { transform: translateY(-8px) scale(.7); opacity: .2; }
  100% { transform: none; opacity: 1; }
}

.cell.revealed { color: var(--gold-soft); border-color: rgba(255, 184, 107, .40); }

.slot.bounce { animation: ky-bounce .55s ease; }
@keyframes ky-bounce {
  0%, 100% { transform: none; }
  30% { transform: translateY(-9px); }
  55% { transform: translateY(0); }
  75% { transform: translateY(-4px); }
}

.slot.aim .cell {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(255, 184, 107, .35);
  cursor: pointer;
}

/* ---------------- bonus şeridi ---------------- */

.bonus {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 16px 4px;
  font-size: 11px;
  color: var(--dim);
  overflow: hidden;
}
.bonus-label {
  color: var(--gold);
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: 9px;
  flex: 0 0 auto;
}
.bonus-list {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gold-soft);
  letter-spacing: .06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- yörünge (harf çemberi) ---------------- */

.orbit {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 2px 0 6px;
}

.current {
  height: 34px;
  min-width: 60px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .18em;
  text-indent: .18em;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease, background .2s ease, border-color .2s ease;
}
.current.show { opacity: 1; transform: none; }
.current.ok { background: rgba(107, 227, 176, .18); border-color: rgba(107, 227, 176, .55); color: #DFFFF2; }
.current.bad { background: rgba(255, 122, 138, .16); border-color: rgba(255, 122, 138, .5); }
.current.dup { background: rgba(255, 184, 107, .16); border-color: rgba(255, 184, 107, .5); }

.wheel-wrap {
  position: relative;
  width: min(84vw, 320px);
  aspect-ratio: 1 / 1;
}

#wheel {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.shuffle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--night);
  background: linear-gradient(160deg, var(--gold-soft), var(--gold));
  box-shadow: 0 6px 18px -6px rgba(255, 184, 107, .9);
  transition: transform .3s cubic-bezier(.2, 1.6, .4, 1);
}
.shuffle svg { width: 21px; height: 21px; stroke-width: 2.1; }
.shuffle:active { transform: rotate(180deg) scale(.92); }

/* ---------------- ipucu araçları ---------------- */

.tools {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 0 12px 10px;
}

.tool {
  flex: 1 1 0;
  min-width: 0;
  height: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--line);
  transition: background .18s ease, transform .18s ease, opacity .18s ease;
}
.tool:active { transform: translateY(1px); background: var(--panel-2); }
.tool[disabled] { opacity: .38; }
.tool.armed { background: rgba(255, 184, 107, .18); border-color: rgba(255, 184, 107, .55); }

.tool-name { font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.tool-cost {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tool-cost::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
}

/* ---------------- bildirim ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 42vh;
  transform: translate(-50%, 10px);
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(12, 18, 48, .92);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 40;
  max-width: 84vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.good { border-color: rgba(107, 227, 176, .5); color: #DFFFF2; }
.toast.warn { border-color: rgba(255, 184, 107, .5); color: var(--gold-soft); }

/* ---------------- alt sayfa / modal ---------------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(6, 9, 26, .72);
  backdrop-filter: blur(10px);
  padding: 16px;
  animation: ky-fade .22s ease both;
}
.sheet[hidden] { display: none; }
@keyframes ky-fade { from { opacity: 0; } to { opacity: 1; } }

.card {
  width: 100%;
  max-width: 480px;
  max-height: 86dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  border-radius: 28px;
  background: linear-gradient(180deg, #1A2350, #121838);
  border: 1px solid var(--line);
  box-shadow: 0 -20px 60px -20px #000;
  animation: ky-rise .32s cubic-bezier(.2, 1.2, .3, 1) both;
  text-align: center;
}
@keyframes ky-rise { from { transform: translateY(26px); opacity: 0; } to { transform: none; opacity: 1; } }

.card h2 {
  margin: 4px 0 2px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: .01em;
}
.card p { margin: 6px 0 0; color: var(--dim); font-size: 14px; line-height: 1.5; }
.card .kicker {
  font-size: 10px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--gold);
}

.card .brand {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  line-height: 1.05;
  margin: 6px 0 0;
  background: linear-gradient(100deg, var(--gold-soft), var(--mint));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tally {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 4px;
}
.tally div {
  flex: 1 1 0;
  padding: 12px 6px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--line);
}
.tally b {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--gold-soft);
}
.tally span { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }

.btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 14px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .02em;
  color: #14183A;
  background: linear-gradient(160deg, var(--gold-soft), var(--gold));
  box-shadow: 0 10px 26px -12px var(--gold);
  transition: transform .16s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn--ghost {
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: none;
  font-size: 14px;
  padding: 11px;
}

.lvgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin-top: 16px;
  text-align: left;
}
.lvgrid button {
  padding: 10px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--line);
  transition: background .18s ease;
}
.lvgrid button:active { background: var(--panel-2); }
.lvgrid button[disabled] { opacity: .34; }
.lvgrid .n {
  display: block;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: .1em;
}
.lvgrid .t { display: block; font-size: 12px; margin-top: 2px; }
.lvgrid .d { display: block; font-size: 10px; margin-top: 4px; color: var(--mint); }
.lvgrid button.done { border-color: rgba(107, 227, 176, .35); }

.foot {
  margin-top: 16px;
  font-size: 11px;
  color: #6C77A8;
  line-height: 1.6;
}

/* ---------------- erişilebilirlik ---------------- */

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .06s !important; }
  .kp { transition-duration: .12s !important; }
}

/* ---------------- kısa ekranlar ---------------- */

@media (max-height: 700px) {
  .scene { max-height: 24vh; min-height: 96px; }
  .wheel-wrap { width: min(72vw, 268px); }
  .current { height: 30px; font-size: 18px; }
  .tool { height: 42px; }
}

@media (min-width: 620px) and (min-height: 760px) {
  .scene { max-height: 36vh; }
}
