:root {
  color-scheme: light;
  --paper: #f8f5ed;
  --card: #fffdf7;
  --line: #e4ddce;
  --ink: #241f18;
  --muted: #625d51;
  --forest: #244e40;
  --dark: #183b30;
  --pale: #e8eee4;
  --rust: #9c5133;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 0;
  background: radial-gradient(ellipse at 42% 19%, #fffcf4 0%, var(--paper) 65%);
}
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, select { color: inherit; }
button, h1, h2, h3, p { margin: 0; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, select:focus-visible, input:focus-visible, canvas:focus-visible { outline: 2px solid var(--rust); outline-offset: 4px; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.shell { width: min(1280px, calc(100% - 88px)); margin-inline: auto; }

.masthead { border-bottom: 1px solid var(--line); background: #faf7efcc; }
.masthead-inner {
  min-height: 68px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  font: 700 31px/1 var(--serif);
  letter-spacing: -0.085em;
  color: var(--dark);
}
.brand-ball {
  background: radial-gradient(at 30% 26%, #527765, #234c3d 57%, #14342b);
  border-radius: 50%;
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 3px #203d3440, inset 0 0 0 1px #ffffff25;
}
.brand-ball > span {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  background: #f8eed7;
  border-radius: 50%;
  font: 700 15px/1 var(--serif);
  letter-spacing: 0;
}
.brand-point { color: var(--rust); }
.masthead-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.header-button, .text-button {
  border: 0;
  background: none;
  color: var(--dark);
  padding: 10px 12px;
  font-size: 0.83rem;
  font-weight: 650;
  line-height: 1.2;
  border-radius: 8px;
}
.header-button:hover, .text-button:hover { background: var(--pale); }
.help-button {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  padding-inline: 13px;
  background: #fbf8f0;
}
.question {
  display: grid;
  place-items: center;
  border: 1px solid #6b8274;
  border-radius: 50%;
  font-size: 0.72rem;
  width: 17px;
  height: 17px;
}

.intro { padding: 28px 0 23px; }
.eyebrow {
  color: var(--rust);
  font-size: 0.69rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.19em;
  display: flex;
  align-items: center;
  gap: 9px;
}
.eyebrow span {
  width: 7px;
  height: 7px;
  background: #b36c43;
  transform: rotate(45deg);
  border-radius: 1px;
}
h1 {
  color: var(--dark);
  font: 400 clamp(3.2rem, 5vw, 4.45rem)/1.06 var(--serif);
  letter-spacing: -0.071em;
  margin: 5px 0 7px;
}
.intro > p:last-child {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}
.modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.mode {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fffcf6;
  padding: 11px 15px;
  border-radius: 13px;
  transition: background 160ms, color 160ms, border-color 160ms, box-shadow 160ms;
}
.mode:hover { border-color: #9aab98; background: #f1f2e9; }
.mode[aria-pressed='true'] {
  background: linear-gradient(115deg, #305a4a, #21483a 75%);
  color: #fff8e8;
  border-color: #21483a;
  box-shadow: 0 4px 9px #25382c24;
}
.mode-icon {
  display: grid;
  place-items: center;
  flex: 0 0 43px;
  height: 43px;
  width: 43px;
  position: relative;
  background: #f0ede0;
  border: 1px solid #eeeadc;
  border-radius: 9px;
  color: var(--dark);
}
.mode[aria-pressed='true'] .mode-icon {
  background: #ffffff17;
  border-color: #ffffff31;
  color: #fff0cd;
}
.mode-game > span {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--dark);
  color: #fff5da;
  font: 700 14px/1 var(--serif);
}
.mode[aria-pressed='true'] .mode-game > span { background: #f4e7c9; color: var(--dark); }
.mode-spin > span {
  width: 23px;
  height: 23px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  position: relative;
}
.mode-spin > span::before {
  content: '';
  position: absolute;
  width: 7px;
  height: 7px;
  background: currentColor;
  border-radius: 50%;
  top: 4px;
  right: 4px;
}
.mode-spin > span::after {
  content: '';
  position: absolute;
  width: 1px;
  height: 25px;
  background: currentColor;
  opacity: 0.42;
  transform: rotate(45deg);
  top: -2px;
  left: 10px;
}
.mode-maths > span {
  width: 23px;
  height: 21px;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  position: relative;
}
.mode-maths > span::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 1.5px;
  background: currentColor;
  bottom: 1px;
  left: 2px;
  transform: rotate(-40deg);
  transform-origin: 0 50%;
}
.mode-maths > span::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 1.5px 1.5px 0 0;
  top: 2px;
  right: 1px;
  transform: rotate(6deg);
}
.mode-copy {
  display: grid;
  flex: 1;
  gap: 4px;
}
.mode-copy strong {
  font-size: 0.91rem;
  font-weight: 720;
  line-height: 1.13;
}
.mode-copy small {
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.28;
}
.mode[aria-pressed='true'] small { color: #e7e8d5; }
.mode-arrow { color: #676554; font-size: 1rem; }
.mode[aria-pressed='true'] .mode-arrow { color: #f2ddae; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 302px;
  align-items: start;
  gap: 20px;
}
.table-card, .controls, .lesson, .analysis {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--card);
  box-shadow: 0 2px 8px #51442f08;
}
.table-card { min-width: 0; padding: 13px 14px 1px; }
.table-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 1px 11px;
}
.table-actions { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.fullscreen-toggle { white-space: nowrap; }
.fullscreen-icon {
  display: inline-block;
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  background:
    linear-gradient(currentColor, currentColor) top left / 5px 1.5px,
    linear-gradient(currentColor, currentColor) top left / 1.5px 5px,
    linear-gradient(currentColor, currentColor) top right / 5px 1.5px,
    linear-gradient(currentColor, currentColor) top right / 1.5px 5px,
    linear-gradient(currentColor, currentColor) bottom left / 5px 1.5px,
    linear-gradient(currentColor, currentColor) bottom left / 1.5px 5px,
    linear-gradient(currentColor, currentColor) bottom right / 5px 1.5px,
    linear-gradient(currentColor, currentColor) bottom right / 1.5px 5px;
  background-repeat: no-repeat;
}
.fullscreen-toggle[aria-pressed='true'] .fullscreen-icon {
  background: linear-gradient(45deg, transparent 46%, currentColor 46% 54%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, currentColor 46% 54%, transparent 54%);
}
.scoreboard {
  display: flex;
  gap: 9px;
  align-items: center;
}
.player {
  min-height: 42px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.player.current { background: #edf1e7; border-color: #e3ebdf; }
.player-token {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #79867a;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px #00000012;
}
[data-camp='gauche'] { --camp-tone: #43835e; }
[data-camp='droite'] { --camp-tone: #ae6231; }
[data-camp] .player-token { background: var(--camp-tone, #79867a); }
.player-info {
  display: grid;
  font-size: 0.78rem;
  font-weight: 680;
  line-height: 1.1;
  white-space: nowrap;
  min-width: 60px;
  gap: 2px;
}
.player-info small {
  font-size: 0.65rem;
  font-weight: 560;
  color: #486051;
}
.player strong {
  min-width: 27px;
  text-align: right;
  color: var(--dark);
  font: 700 24px/1 var(--serif);
  font-variant-numeric: tabular-nums;
}
.score-divider {
  width: 1px;
  height: 24px;
  background: var(--line);
}
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: #fbf8f1;
  color: var(--dark);
  border-radius: 8px;
  min-height: 35px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 680;
}
.secondary:hover { background: #edf1e7; border-color: #bccbbb; }
.reset span:first-child { font-size: 1.05rem; line-height: 1; }
.table-area { position: relative; }
canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1178 / 638;
  border-radius: 15px;
  box-shadow: 0 7px 12px #59351728, 0 1px 3px #26251b32;
  cursor: crosshair;
  touch-action: none;
}
canvas[aria-disabled='true'] { cursor: default; }
.table-bottom {
  display: flex;
  gap: 8px 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  min-height: 44px;
  padding: 8px 1px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}
#game-status { font-weight: 640; color: #3d5a4b; }
.aim-tip {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.aim-mobile { display: none; }
.aim-dot {
  flex: 0 0 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid #708678;
  box-shadow: inset 0 0 0 1px #fffcf5;
  background: #708678;
}
.trajectory-legend { display: flex; gap: 10px; }
.camp-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.camp-legend span { display: inline-flex; align-items: center; gap: 5px; }
.camp-legend i { width: 9px; height: 9px; border: 2px solid var(--camp-tone); border-radius: 50%; }
.final-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid #e6cd9a;
  border-radius: 8px;
  background: #f7e9c9;
  color: #493316;
  font-size: 0.79rem;
}
.final-notice output {
  flex-shrink: 0;
  padding: 3px 6px;
  border-radius: 5px;
  background: #fdf7e7;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}
.trajectory-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.trajectory-legend i { width: 12px; border-top: 2px dashed #518764; }
.trajectory-legend span + span i { border-color: #b87b32; }
#force-legend i { border-top: 2px solid #a35049; }
.exercise {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
}
.exercise label {
  color: var(--dark);
  font-size: 0.8rem;
  font-weight: 700;
}
.exercise select, .opponent select {
  border-radius: 7px;
  padding: 6px 6px 6px 8px;
  color: var(--dark);
  background: #fbf8f1;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 600;
}

.controls { padding: 16px; }
.controls-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 13px;
  margin-bottom: 13px;
}
h2 {
  color: var(--dark);
  font: 700 1.42rem/1.12 var(--serif);
  letter-spacing: -0.05em;
}
.controls-icon { color: var(--rust); font-size: 0.9rem; }
fieldset {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}
.control-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 7px 4px;
}
.control-row label, .opponent label { font-size: 0.79rem; font-weight: 710; }
.control-row output {
  font-size: 0.74rem;
  color: var(--dark);
  background: #eef0e6;
  padding: 3px 7px;
  border-radius: 5px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
input[type='range'] {
  --fill: 50%;
  appearance: none;
  grid-column: 1 / -1;
  display: block;
  height: 19px;
  margin: 0;
  width: 100%;
  cursor: pointer;
  background: transparent;
  border-radius: 7px;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 5px;
  background: linear-gradient(to right, #547964 0 var(--fill), #e7e3d7 var(--fill) 100%);
  border-radius: 9px;
}
input[type='range']::-moz-range-track {
  height: 5px;
  background: linear-gradient(to right, #547964 0 var(--fill), #e7e3d7 var(--fill) 100%);
  border-radius: 9px;
}
input[type='range']::-webkit-slider-thumb {
  appearance: none;
  margin-top: -5px;
  height: 15px;
  width: 15px;
  border-radius: 50%;
  border: 2px solid #fefcf2;
  background: #315c48;
  box-shadow: 0 0 0 1px #315c48;
}
input[type='range']::-moz-range-thumb {
  height: 12px;
  width: 12px;
  border-radius: 50%;
  border: 2px solid #fefcf2;
  background: #315c48;
  box-shadow: 0 0 0 1px #315c48;
}
input[type='range']:disabled, .impact-ball:disabled, .presets button:disabled { opacity: 0.54; cursor: default; }
.impact-control {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 10px 0 12px;
  padding: 12px 0;
}
.impact-stage {
  position: relative;
  display: grid;
  justify-items: center;
  align-items: center;
  padding: 12px 0 11px;
}
.impact-ball {
  --impact-x: 0%;
  --impact-y: 0%;
  position: relative;
  padding: 0;
  width: 100px;
  height: 100px;
  border: 1px solid #d1c7b1;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 26%, #fffef7 3%, #fbf3e1 39%, #e4d8bf 66%, #ae9a7e 97%);
  cursor: crosshair;
  touch-action: none;
  box-shadow: 6px 9px 14px #56453126, inset 0 0 3px #f2e7cd;
}
.impact-ball::before, .impact-ball::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.impact-ball::before { width: 84%; border-top: 1px dashed #8a7a5e75; }
.impact-ball::after { height: 84%; border-left: 1px dashed #8a7a5e75; }
.impact-guides {
  position: absolute;
  inset: 17%;
  border: 1px solid #8a7a5e73;
  border-radius: 50%;
}
.impact-marker {
  position: absolute;
  z-index: 1;
  left: calc(50% + var(--impact-x));
  top: calc(50% - var(--impact-y));
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border: 2px solid #fff9e8;
  background: #a45436;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #8a4e34;
}
.presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.presets button {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 27px;
  padding: 4px 3px;
  background: #fcf9f1;
  font-size: 0.72rem;
  font-weight: 640;
  color: #4e4a40;
}
.presets button:hover, .presets button[aria-pressed='true'] {
  background: var(--pale);
  border-color: #c8d4c5;
  color: var(--dark);
}
.primary {
  border: 1px solid #234838;
  border-radius: 8px;
  background: linear-gradient(110deg, #315e4b, #214939);
  color: #fff8e9;
  min-height: 42px;
  padding: 9px 12px;
  font-weight: 700;
  font-size: 0.83rem;
}
.primary:not(:disabled):hover { background: #173b2f; }
.primary:disabled { background: #657d70; border-color: #657d70; }
.shoot {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.shoot span { color: #f4d9a7; font-size: 1rem; }
.opponent {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
}
.computer-level { margin-top: 7px; }
.preview-options {
  margin-top: 13px;
  color: var(--dark);
  font-size: 0.76rem;
}
.preview-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}
input[type='checkbox'] {
  accent-color: var(--forest);
  margin: 0;
  width: 15px;
  height: 15px;
}

.lesson, .analysis { grid-column: 1 / -1; min-width: 0; }
.lesson { padding: 15px 16px; }
.analysis { padding: clamp(12px, 2.15vw, 28px); scroll-margin-top: 12px; }
.lesson-heading, .analysis-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lesson-heading .mode-icon { flex-basis: 34px; height: 34px; }
.lesson p, .analysis p {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}
.lesson p { margin-top: 7px; }
#lesson-feedback { color: var(--dark); font-weight: 620; }
.analysis-heading { justify-content: space-between; margin: 0 0 16px; align-items: start; }
.analysis-heading h2 { font-size: clamp(1.45rem, 3vw, 2rem); }
.analysis-heading p { margin-top: 4px; }
.analysis .calculation-unit {
  font-size: 0.82rem;
  text-align: right;
}
.calculation-grid {
  display: grid;
  gap: 12px;
}
.calculation-grid article {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.8fr);
  gap: clamp(12px, 2vw, 26px);
  border: 1px solid var(--line);
  background: #f8f6ed;
  border-radius: 10px;
  padding: clamp(10px, 1.6vw, 20px);
}
.calculation-intro h3 { color: var(--dark); font: 700 1.15rem/1.2 var(--serif); }
.calculation-intro p { margin-top: 7px; }
.calculation-details { min-width: 0; }
.calculation-steps { margin: 0; min-width: 0; }
.calculation-steps > div {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.4fr);
  align-items: baseline;
  gap: 3px 14px;
  padding: 7px 0;
}
.calculation-steps > div + div { border-top: 1px solid var(--line); }
.calculation-steps > div:first-child { padding-top: 1px; }
.calculation-steps dt { color: var(--muted); font-size: 0.91rem; line-height: 1.35; }
.calculation-steps dd {
  margin: 0;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  color: var(--dark);
  font-size: clamp(0.82rem, 1vw, 0.96rem);
  line-height: 1.5;
}
.calculation-steps code { display: block; font: 600 1em/1.5 ui-monospace, monospace; }
.analysis .calculation-empty { padding: 10px 12px; border-radius: 7px; background: #eceee4; }
.calculation-link { padding-inline: 0; margin-top: 6px; text-decoration: underline; text-underline-offset: 3px; }
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0 15px;
  color: var(--muted);
  font-size: 0.75rem;
}
.footer .text-button { font-size: 0.75rem; }

.result {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 20px;
  width: min(87%, 310px);
  background: #fffcf1f5;
  border: 1px solid #f3e7cc;
  box-shadow: 0 8px 40px #09241a8c;
  border-radius: 13px;
  text-align: center;
  color: var(--dark);
}
.result > span {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--rust);
}
.result strong {
  display: block;
  font: 700 1.62rem/1.1 var(--serif);
  margin: 6px 0;
}
.result p {
  margin-bottom: 9px;
  font-size: 0.86rem;
  color: var(--muted);
}
.result button { min-width: 120px; }
dialog {
  width: min(540px, calc(100% - 30px));
  max-height: calc(100% - 30px);
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--card);
  padding: 24px;
  color: var(--ink);
  box-shadow: 0 10px 50px #21382c52;
}
dialog::backdrop { background: #122a21a1; }
dialog .close {
  position: absolute;
  right: 15px;
  top: 15px;
  width: 35px;
  font-size: 1.3rem;
}
dialog h2 { font-size: 2rem; margin: 5px 0 8px; }
dialog h3 {
  color: var(--dark);
  font-size: 1rem;
  margin: 15px 0 4px;
}
dialog ol { padding-left: 22px; }
dialog p:not(.eyebrow), dialog li {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}
dialog li + li { margin-top: 7px; }

@media (min-width: 1450px) { .intro { padding-top: 35px; } }
@media (max-width: 1070px) {
  .shell { width: calc(100% - 52px); }
  .workspace { grid-template-columns: minmax(0, 1fr) 265px; gap: 14px; }
  .mode { padding-inline: 11px; gap: 9px; }
  .mode-icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }
  .control-row label, .opponent label { font-size: 0.76rem; }
}
@media (max-width: 820px) {
  .shell { width: calc(100% - 36px); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .controls { padding: 15px; }
  #shot-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 8px 16px;
  }
  #shot-controls .impact-control {
    grid-column: 2;
    grid-row: 1 / 4;
    margin: 0;
    padding: 0 0 0 14px;
    border: 0;
    border-left: 1px solid var(--line);
  }
  #shot-controls .shoot { margin-top: 0; }
}
@media (max-width: 960px) {
  .calculation-steps > div { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 660px) {
  .calculation-grid article { grid-template-columns: minmax(0, 1fr); }
  .calculation-steps > div:first-child { border-top: 1px solid var(--line); padding-top: 8px; }
}
@media (max-width: 360px) {
  .analysis, .calculation-grid article { padding-inline: 8px; }
  .calculation-steps code { letter-spacing: -0.02em; }
}
@media (max-width: 560px) {
  .shell { width: auto; margin-inline: max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-right)); }
  .masthead-inner { min-height: 54px; }
  .brand { font-size: 1.65rem; gap: 7px; }
  .brand-ball { width: 31px; height: 31px; }
  .brand-ball > span {
    width: 17px;
    height: 17px;
    font-size: 0.78rem;
  }
  .masthead-actions { gap: 2px; }
  .header-button {
    padding: 7px 8px;
    font-size: 0.73rem;
    min-height: 34px;
  }
  .help-button { gap: 4px; }
  .question {
    width: 14px;
    height: 14px;
    font-size: 0.66rem;
  }
  .intro { padding: 12px 0 9px; }
  h1 { font-size: clamp(2.45rem, 10vw, 3.35rem); }
  .intro > p:last-child { display: none; }
  .modes { gap: 5px; margin-bottom: 9px; }
  .mode {
    display: grid;
    justify-items: center;
    text-align: center;
    gap: 5px;
    min-height: 63px;
    padding: 6px 3px;
    border-radius: 9px;
  }
  .mode-icon {
    width: 25px;
    height: 25px;
    border: 0;
    background: transparent;
  }
  .mode[aria-pressed='true'] .mode-icon { background: transparent; }
  .mode-game > span {
    width: 18px;
    height: 18px;
    font-size: 0.72rem;
  }
  .mode-spin > span, .mode-maths > span { transform: scale(0.75); }
  .mode-copy strong { font-size: 0.70rem; }
  .mode-copy small, .mode-arrow { display: none; }
  .workspace { gap: 9px; }
  .table-card { padding: 5px 5px 0; border-radius: 11px; }
  .table-top {
    gap: 4px;
    padding-bottom: 5px;
    min-height: 38px;
  }
  .table-actions { gap: 4px; }
  .table-actions .secondary { min-height: 38px; }
  .table-actions .reset { min-width: 36px; }
  #reset-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .exercise { min-width: 0; }
  .exercise label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .exercise select { max-width: 100%; }
  .scoreboard { gap: 3px; }
  .player {
    padding: 3px 4px;
    gap: 4px;
    min-height: 34px;
  }
  .player-info { font-size: 0.64rem; min-width: 47px; }
  .player-info small { font-size: 0.52rem; }
  .player strong { min-width: 17px; font-size: 1.18rem; }
  .player-token { width: 6px; height: 6px; }
  .secondary {
    padding-inline: 5px;
    gap: 3px;
    min-height: 31px;
    font-size: 0.64rem;
  }
  canvas { border-radius: 8px; }
  .table-bottom {
    min-height: 32px;
    padding-block: 6px;
    font-size: 0.65rem;
  }
  .aim-full { display: none; }
  .aim-mobile { display: inline; }
  .controls { padding: 11px; }
  .controls-heading { margin-bottom: 10px; padding-bottom: 9px; }
  h2 { font-size: 1.26rem; }
  #shot-controls { column-gap: 10px; }
  #shot-controls .impact-control { padding-left: 9px; }
  .impact-control .control-row {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 3px;
  }
  .impact-ball { width: 84px; height: 84px; }
  .impact-stage { padding: 7px 0; }
  .presets { gap: 3px; }
  .presets button { font-size: 0.73rem; min-height: 34px; }
  input[type='range'] { height: 30px; }
  .shoot { min-height: 45px; }
  .footer { padding-top: 7px; }
}
body.game-immersive { overflow: hidden; }
.workspace.is-immersive {
  --room-gutter: clamp(8px, 2vmin, 24px);
  --room-top: max(var(--room-gutter), env(safe-area-inset-top));
  --room-right: max(var(--room-gutter), env(safe-area-inset-right));
  --table-clearance: 132px;
  position: fixed;
  z-index: 5;
  inset: 0;
  grid-template-columns: minmax(0, 1fr) clamp(210px, 20vw, 285px);
  align-content: start;
  gap: clamp(10px, 2vmin, 24px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--room-top) var(--room-right) max(var(--room-gutter), env(safe-area-inset-bottom))
    max(var(--room-gutter), env(safe-area-inset-left));
  background: radial-gradient(ellipse at 38% 30%, #365446, #1a332a 76%);
}
.workspace.is-immersive .table-card { padding: 0; border: 0; background: none; box-shadow: none; }
.workspace.is-immersive .table-card:has(.final-notice:not([hidden])) { --table-extra: 44px; }
.workspace.is-immersive .table-area {
  max-width: max(250px, calc((100vh - var(--table-clearance) - var(--table-extra, 0px)) * 1.846));
  max-width: max(250px, calc((100dvh - var(--table-clearance) - var(--table-extra, 0px)) * 1.846));
  margin-inline: auto;
}
.workspace.is-immersive .table-bottom, .workspace.is-immersive #game-status { color: #f7efdc; }
.workspace.is-immersive .trajectory-legend i { border-color: #b9eed2; }
.workspace.is-immersive .trajectory-legend span + span i { border-color: #ffc875; }
.workspace.is-immersive #force-legend i { border-color: #f4a8a1; }
.workspace.is-immersive .table-area canvas { box-shadow: 0 8px 26px #08130db3; }
.workspace.is-immersive .player:not(.current), .workspace.is-immersive .player:not(.current) strong,
.workspace.is-immersive .exercise label { color: #f7efdc; }
.workspace.is-immersive .player:not(.current) small { color: #f0dfc5; }
.workspace.is-immersive [data-camp='gauche']:not(.current) { --camp-tone: #a4e0bb; }
.workspace.is-immersive [data-camp='droite']:not(.current) { --camp-tone: #ffd395; }
.workspace.is-immersive .score-divider { background: #eee3c34d; }
.workspace.is-immersive .controls { margin-top: 46px; }
.workspace.is-immersive .fullscreen-toggle {
  position: fixed;
  z-index: 2;
  top: var(--room-top);
  right: var(--room-right);
  background: #fbf8f1;
  min-height: 36px;
  padding-inline: 11px;
}
.workspace.is-immersive .fullscreen-toggle:hover { background: var(--pale); }
.workspace.is-immersive .analysis { scroll-margin-top: 54px; }
@media (max-width: 820px) {
  .workspace.is-immersive { grid-template-columns: minmax(0, 1fr); }
  .workspace.is-immersive .controls { margin-top: 0; }
  .workspace.is-immersive .table-actions { padding-right: 86px; }
}
@media (max-width: 360px) {
  #fullscreen-label { display: none; }
  .fullscreen-toggle { min-width: 36px; }
  .workspace.is-immersive .table-actions { padding-right: 49px; }
}
.impact-label-compact { display: none; }
@media (orientation: landscape) and (max-height: 540px) {
  .workspace.is-immersive {
    --table-clearance: 99px;
    grid-template-columns: minmax(0, 1fr) clamp(153px, 23vw, 225px);
  }
  .workspace.is-immersive .table-actions { padding-right: 0; }
  .workspace.is-immersive .controls { margin-top: 41px; padding: 8px; }
  .workspace.is-immersive .controls-heading { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .workspace.is-immersive #shot-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .workspace.is-immersive #shot-controls .impact-control {
    grid-column: auto;
    grid-row: auto;
    margin: 0;
    padding: 4px 0;
    border-block: 1px solid var(--line);
    border-inline: 0;
  }
  .workspace.is-immersive .control-row { gap: 3px; }
  .workspace.is-immersive .impact-ball { width: 57px; height: 57px; }
  .workspace.is-immersive .impact-stage { padding: 4px 0; }
  .workspace.is-immersive .presets button { min-height: 27px; padding-block: 3px; }
  .workspace.is-immersive .shoot { min-height: 38px; margin-top: 1px; }
  .workspace.is-immersive .opponent, .workspace.is-immersive .preview-options { margin-top: 6px; }
  .workspace.is-immersive .opponent label { font-size: 0.7rem; }
  .workspace.is-immersive .opponent select { font-size: 0.7rem; padding: 3px; }
  .workspace.is-immersive .aim-full { display: none; }
  .workspace.is-immersive .aim-mobile { display: inline; }
}
@media (orientation: landscape) and (max-height: 360px) {
  .workspace.is-immersive .impact-label-full { display: none; }
  .workspace.is-immersive .impact-label-compact { display: inline; }
  .workspace.is-immersive .impact-ball { width: 49px; height: 49px; }
  .workspace.is-immersive .impact-stage { padding-block: 3px; }
  .workspace.is-immersive .control-row output { font-size: 0.68rem; padding-inline: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
