:root {
  color-scheme: light;
  --paper: #efe4d1;
  --ivory: #fff3db;
  --ink: #272b21;
  --forest: #20362b;
  --muted: #655b4d;
  --line: #3b301e30;
  --gold: #f3cd8a;
  --oxblood: #81492c;
  --display: Georgia, 'Times New Roman', serif;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(ellipse at 5% 35%, #fcf0d8 0, transparent 55%), var(--paper);
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .35; cursor: default; }
a { color: inherit; }
:is(button, a, canvas):focus-visible { outline: 3px solid #c97c3a; outline-offset: 3px; }
button, a, canvas { -webkit-tap-highlight-color: transparent; }
button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.app-shell { width: min(1080px, calc(100% - 56px)); margin: auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 78px; border-bottom: 1px solid var(--line); }
.brand, .header-actions { display: flex; align-items: center; }
.brand { gap: 10px; color: var(--forest); }
.brand-mark { width: 34px; height: 40px; color: #b67b4c; flex: 0 0 auto; }
.brand-series { display: block; font-size: 9px; line-height: 1; letter-spacing: .3em; font-weight: 800; margin-left: 2px; }
.brand h1 { margin: 0; font: bold 32px/.98 var(--display); letter-spacing: -.046em; }
.header-actions { gap: 5px; }
.utility-button, .icon-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; min-width: 44px; padding: 0 10px; border: 1px solid transparent;
  border-radius: 50px; background: transparent; font-size: 12px; font-weight: 650;
}
.utility-button:hover, .icon-button:hover:not(:disabled) { background: #e9dcc8; }
.utility-button[aria-pressed=true] { color: var(--forest); }
.pause-button { padding: 0; border-color: var(--line); }
.pause-button svg { stroke-width: 2.5; }

.street-lobby { padding: 23px 0 19px; }
body:not([data-phase=idle]) .street-lobby,
body[data-phase=idle] .play-layout,
body[data-phase=idle] .pause-button { display: none; }

.street-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: clamp(300px, 36vw, 435px);
  padding: clamp(24px, 5vw, 58px);
  border: 1px solid #6c4a34;
  border-radius: 10px;
  overflow: hidden;
  background:
    linear-gradient(90deg, #241c14f2, #241c14a6 38%, #251c1440 63%, transparent),
    linear-gradient(0deg, #21191152, transparent 38%),
    url("assets/sokak-kapak.webp") 58% 57% / cover,
    #745335;
  color: var(--ivory);
  box-shadow: 0 7px 20px #37281429;
}

.intro-copy { position: relative; max-width: min(100%, 510px); }
.intro-copy h2 {
  margin: 0 0 16px;
  font: bold clamp(54px, 7.45vw, 100px)/.89 var(--display);
  letter-spacing: -.071em;
  text-wrap: balance;
}
.intro-copy h2 em { display: block; margin-top: .1em; color: #ffdfaa; font-size: .84em; font-weight: 400; }
.intro-description { max-width: 44ch; margin: 0; color: #fff0d0; font-size: 15px; font-weight: 520; line-height: 1.55; }

.cup-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 85px;
  margin: 13px 0 0;
  padding: 12px 20px;
  color: #fff0ce;
  border: 1px solid #564f31;
  border-radius: 9px;
  background:
    linear-gradient(90deg, #243629 20%, #29382be8 62%, #26362bc2),
    url("assets/kupa-final.webp") center 65% / cover,
    #25382b;
  text-decoration: none;
  box-shadow: 0 3px 8px #36281828;
}

.cup-entry-copy { display: grid; gap: 5px; min-width: 0; }
.cup-entry-copy strong { font: bold clamp(1.6rem, 3.2vw, 2.2rem)/.98 var(--display); letter-spacing: -.045em; overflow-wrap: anywhere; }
.cup-entry-copy > span { color: #eee0b9; font-size: .85rem; line-height: 1.3; }
.cup-entry-action { display: flex; align-items: center; gap: 10px; color: #ffedc4; font-size: .83rem; font-weight: 750; }
.cup-entry .street-arrow { border-color: #dbc37e95; background: #11241aa5; }
.cup-entry:hover { border-color: #9b7b49; }
.cup-entry:hover .street-arrow { background: #f4d39a; color: #2e3929; }

.street-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin: 13px 0 0; }
.street-mode {
  display: grid;
  position: relative;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 113px;
  isolation: isolate;
  gap: 11px;
  overflow: hidden;
  padding: 12px 20px;
  border: 1px solid var(--card-border);
  border-radius: 9px;
  background: var(--card-color);
  color: #fff3d7;
  text-decoration: none;
  box-shadow: 0 3px 7px #33211029;
  transition: border-color .16s, background-color .16s;
}
.street-mode::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(90deg, var(--card-color) 10%, var(--card-shadow) 48%, #22180c34 78%),
    var(--card-art) center 25% / cover;
}
.mode-hole { --card-border: #724e37; --card-color: #51311f; --card-shadow: #51311fd7; --card-art: url("assets/kuyu.webp"); }
.mode-triangle { --card-border: #6e5c3e; --card-color: #494531; --card-shadow: #494531d6; --card-art: url("assets/ucgen.webp"); }
.street-mode-copy { display: grid; position: relative; z-index: 1; min-width: 0; justify-items: start; gap: 5px; }
.street-mode-copy > * { max-width: 100%; overflow-wrap: anywhere; hyphens: auto; }
.street-mode-copy strong { font: bold clamp(1.7rem, 3.7vw, 2.5rem)/.96 var(--display); letter-spacing: -.045em; }
.street-mode-copy > span { color: #f7e1c4; font-size: .85rem; font-weight: 600; line-height: 1.3; }
.street-mode-icon {
  position: absolute;
  inset: 50% 62px auto auto;
  width: 51px;
  height: 51px;
  transform: translateY(-50%) rotate(-8deg);
  color: #ffedc7b5;
  fill: #3a2c2350;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.street-arrow {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border: 1px solid #fff1c877;
  border-radius: 50%;
  background: #3c2c20a8;
  color: #fff2d0;
  font-size: 20px;
  line-height: 1;
}
.street-mode:hover { border-color: #f4ca85; }
.street-mode:hover .street-arrow { color: #472f22; background: #f8d69a; }

.mode-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.primary-button, .secondary-button, .practice-button {
  min-height: 46px; min-width: 0; padding: 8px 13px; display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; border: 1px solid transparent; border-radius: 7px; text-align: center; text-decoration: none;
  font-size: 14px; font-weight: 720; line-height: 1.2; overflow-wrap: anywhere;
}
.primary-button { background: var(--oxblood); color: var(--ivory); box-shadow: inset 0 1px #ffffff20, 0 3px 0 #4c2522; }
.primary-button:hover { background: #9c5d39; }
.secondary-button { background: var(--forest); color: var(--ivory); box-shadow: inset 0 1px #ffffff20, 0 3px 0 #18241c; }
.secondary-button:hover { background: #2b4937; }
.practice-button { background: #fbf0d772; border-color: #6e533b54; color: var(--forest); font-size: .8rem; }
.practice-button:hover { background: #fff2d9; }

.play-layout { display: grid; grid-template-columns: minmax(0, 175px) minmax(0, max-content); align-items: start; justify-content: center; gap: 20px; padding: 15px 0; }
.play-guide { min-width: 0; display: grid; gap: 15px; }
.play-home { display: inline-flex; gap: 6px; align-items: center; min-height: 44px; color: var(--forest); font-size: .87rem; font-weight: 720; text-decoration: none; }
.play-home:hover span:last-child { text-decoration: underline; }
.how-to { list-style: none; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--line); display: grid; gap: 11px; }
.how-to h3 { margin: 0 0 1px; font-size: 13px; }
.how-to p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.personal-record { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 11px; border-radius: 7px; border: 1px solid var(--line); font-size: 10px; font-weight: 800; color: var(--forest); }
.personal-record strong { font: bold 21px/1 var(--display); font-variant-numeric: tabular-nums; }
.stat-label, .board-label, .growth-heading, .eyebrow { font-size: 10px; line-height: 1.35; letter-spacing: .11em; font-weight: 750; }

.game-card {
  min-width: 0; overflow: hidden; border: 1px solid #5f6250; border-radius: 16px;
  background: #26372c; color: var(--ivory); box-shadow: 0 13px 30px #37241126, 0 3px 8px #3724112a, inset 0 1px #fff8dc2a;
}
.game-card-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; padding: 13px 17px 0; }
.board-label { color: #f4dcac; }
.mode-badge { border: 1px solid #c4b08555; padding: 3px 7px; font-size: 9px; line-height: 1.25; border-radius: 4px; color: #f1dfbe; }
.scoreboard { display: grid; grid-template-columns: 1fr 1fr .75fr; gap: 10px; padding: 9px 17px 11px; }
.stat-label { display: block; color: #d7cca9; margin-bottom: 4px; font-size: 9px; }
.scoreboard strong { display: block; font: bold 29px/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.time-stat { border-left: 1px solid #e5d5ae32; padding-left: 12px; }
.time-stat.is-urgent strong { color: #ffad92; }
.combo-stat { text-align: right; }
.combo-stat strong { color: var(--gold); }
.combo-track { width: 38px; height: 3px; border-radius: 99px; background: #e7cf9e3d; margin: 4px 0 0 auto; overflow: hidden; }
#combo-fill { height: 100%; width: 0; background: var(--gold); border-radius: inherit; }
.game-stage {
  position: relative; display: flex; justify-content: center; overflow: hidden; isolation: isolate; line-height: 0;
  margin-inline: 7px; border-radius: 10px; background: #121f1d;
}
.game-stage canvas {
  display: block; width: min(100%, 460px, calc((100svh - 228px) * .741935)); min-width: min(100%, 240px);
  height: auto; aspect-ratio: 460 / 620; background: #6e5237 url("assets/saha.webp") center / cover; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.game-stage canvas:focus-visible { outline-offset: -4px; }
.growth-panel { padding: 11px 17px 12px; }
.growth-heading, .board-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 3px 8px; color: #e7d5ac; }
.growth-heading > span:first-child { display: flex; align-items: center; gap: 6px; }
.growth-symbol { color: var(--gold); font-size: 15px; line-height: .8; }
.level-pill { color: #ffe5ab; margin-left: 4px; font-size: 9px; }
.growth-track { height: 4px; border-radius: 99px; background: #e7cf9e33; overflow: hidden; margin-top: 6px; }
#growth-fill { height: 100%; width: 0; background: #eabf72; border-radius: inherit; transition: width .25s ease; }
.board-bottom { font-size: 10px; margin-top: 7px; }
.status { display: inline-flex; align-items: center; gap: 5px; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: #d7a661; flex: 0 0 auto; }
body[data-phase=playing] .status-dot { background: #addb9d; }

.site-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 18px; min-height: 48px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.site-footer p { margin: 0; }
.site-footer kbd { display: inline-block; min-width: 18px; margin-right: 2px; padding: 0 3px; text-align: center; background: #fff6e3; border: 1px solid var(--line); border-radius: 3px; font: inherit; }
.footer-divider { margin-inline: 6px; color: #7b6957; }
.motion-button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 5px; border: 0; background: transparent; }
.toggle-track { display: block; width: 24px; height: 14px; background: #766b5c; border-radius: 99px; padding: 3px; }
.toggle-track span { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--ivory); }
.motion-button[aria-pressed=true] .toggle-track { background: var(--forest); }
.motion-button[aria-pressed=true] .toggle-track span { transform: translateX(10px); }

.game-dialog {
  width: min(436px, calc(100% - 28px)); max-height: calc(100svh - 32px); overflow: auto;
  padding: 26px; border: 1px solid #85674973; border-radius: 17px; background: #fff0d8;
  color: var(--ink); text-align: center; box-shadow: 0 20px 100px #15150d60;
}
.game-dialog::backdrop { background: #121914b8; backdrop-filter: blur(5px); }
.dialog-marble { width: 26px; height: 26px; margin: 0 auto 11px; border-radius: 50%; background: radial-gradient(circle at 34% 28%, #fff7c9 0 8%, #cda251 13%, #8d512e 67%, #2b2413 100%); box-shadow: 0 3px 4px #412a164d; }
.eyebrow { margin: 0 0 8px; color: var(--oxblood); }
.game-dialog h2 { margin: 0 0 13px; font: bold clamp(27px, 6vw, 39px)/.99 var(--display); letter-spacing: -.035em; overflow-wrap: anywhere; }
.game-dialog #overlay-body { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.dialog-actions { display: grid; gap: 9px; }
.dialog-links { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0 5px; margin-bottom: 9px; font-size: 12px; }
.dialog-links a, .link-button, .language-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: var(--forest); text-decoration: underline; text-underline-offset: 3px; }
.language-link { font-size: 13px; justify-self: center; }
.language-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 18px 0 13px; }
.language-option { min-height: 46px; padding: 6px; border: 1px solid #74634e77; border-radius: 7px; background: transparent; overflow-wrap: anywhere; }
.language-option[aria-pressed=true] { background: var(--forest); border-color: var(--forest); color: var(--ivory); }
.language-option:hover { box-shadow: inset 0 0 0 2px #a5834977; }
.result-score { margin: 0 0 14px; color: var(--oxblood); font: bold 56px/1 var(--display); font-variant-numeric: tabular-nums; }
.result-details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; border-block: 1px solid var(--line); padding: 12px 0; margin: 0 0 16px; }
.result-details:empty { display: none; }
.result-details > div { display: grid; gap: 4px; }
.result-details > div + div { border-left: 1px solid var(--line); }
.result-details strong { font: bold 22px/1 var(--display); }
.result-details span { color: var(--muted); font-size: 11px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 760px) {
  .app-shell { width: calc(100% - 22px); max-width: 510px; }
  .site-header { min-height: 56px; }
  .brand { gap: 5px; }
  .brand-mark { width: 26px; height: 30px; }
  .brand h1 { font-size: clamp(17px, 4.9vw, 26px); }
  .brand-series { font-size: 7px; }
  .header-actions { gap: 0; }
  .utility-button, .icon-button { padding: 0; }
  .utility-button span { display: none; }
  .language-button { min-width: 50px; gap: 3px; }
  .language-button #language-code { display: inline; font-size: 10px; }
  .street-lobby { padding: 11px 0 13px; }
  .street-hero {
    min-height: clamp(224px, 65vw, 305px);
    padding: 17px 16px;
    background-image:
      linear-gradient(0deg, #261d14ee, #261d1494 44%, #251c1426 74%, transparent),
      url("assets/sokak-kapak.webp");
    background-position: center, 66% 50%;
    background-size: cover;
  }
  .intro-copy h2 { margin-bottom: 9px; font-size: clamp(37px, 9.8vw, 54px); line-height: .95; text-wrap: initial; }
  .intro-description { max-width: 43ch; font-size: 12px; line-height: 1.4; }
  .cup-entry { min-height: 74px; margin-top: 8px; padding: 9px 10px; gap: 5px; }
  .cup-entry-copy strong { font-size: clamp(1.22rem, 5.9vw, 1.65rem); }
  .cup-entry-copy > span { font-size: .67rem; }
  .cup-entry-action { gap: 5px; font-size: .66rem; white-space: nowrap; }
  .cup-entry .street-arrow { flex-shrink: 0; align-self: center; }
  .street-modes { gap: 7px; margin-top: 8px; }
  .street-mode { min-height: 96px; padding: 10px 8px; gap: 4px; grid-template-columns: minmax(0, 1fr) auto; }
  .street-mode-copy { gap: 4px; }
  .street-mode-copy strong { font-size: clamp(1.22rem, 6.1vw, 1.71rem); }
  .street-mode-copy > span { font-size: .69rem; line-height: 1.25; }
  .street-mode-icon { width: 40px; height: 40px; inset-inline-end: 20px; opacity: .42; }
  .street-arrow { width: 25px; height: 25px; align-self: end; font-size: 15px; }
  .mode-actions { gap: 6px; margin-top: 9px; }
  .mode-actions .practice-button { min-height: 44px; padding-inline: 10px; font-size: .73rem; }
  .play-layout { grid-template-columns: minmax(0, max-content); gap: 2px; padding: 0 0 8px; }
  .play-guide { display: block; }
  .play-home { min-height: 38px; font-size: .77rem; }
  .how-to, .personal-record, .keyboard-hint { display: none; }
  .game-stage canvas { width: min(100%, 440px, calc((100svh - 225px) * .741935)); min-width: min(100%, 195px); }
  .game-card-top { padding: 8px 12px 0; }
  .mode-badge { padding: 2px 6px; }
  .scoreboard { padding: 5px 12px 7px; }
  .scoreboard strong { font-size: 24px; }
  .growth-panel { padding: 7px 12px 8px; }
  .site-footer { justify-content: flex-end; }
  .game-dialog { padding: 19px; }
}

@media (max-width: 340px) {
  .app-shell { width: calc(100% - 14px); }
  .street-hero { min-height: 210px; padding: 12px; }
  .brand-mark { display: none; }
  .brand h1 { font-size: 16px; }
}

@media (max-height: 680px) and (min-width: 761px) {
  .site-header { min-height: 60px; }
  .play-layout { padding-top: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
body[data-reduced-motion=true] *, body[data-motion=reduced] * { transition: none !important; animation: none !important; }
