@font-face {
  font-family: Barlow Condensed;
  src: url('assets/title.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: Source Sans 3;
  src: url('assets/body.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #e9f8f8;
  --ink: #06283e;
  --muted: #355d6d;
  --line: #a2ced1;
  --accent: #007686;
  --board: #0c364b;
  --bright: #66e8e4;
  --paper: #fff;
  font-family: "Source Sans 3", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; color: inherit; }

.workbench {
  width: min(70rem, calc(100% - 3rem));
  margin: 0 auto;
  padding: clamp(.85rem, 2.35vw, 1.6rem) 0 2rem;
}

.game-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem 1rem;
  margin-bottom: clamp(.65rem, 1.7vw, 1rem);
}

.back-to-site {
  display: inline-flex;
  align-items: center;
  gap: .48rem;
  min-height: 44px;
  padding: .35rem .83rem;
  border: 1px solid #7cabb7;
  border-radius: .44rem;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 2px 0 #245b6e2d;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}
.back-to-site span { color: var(--accent); font-size: 1.35em; }
.back-to-site:hover { background: #d8f4f4; }

.game-header {
  padding: clamp(.85rem, 2.15vw, 1.45rem) clamp(.9rem, 2.65vw, 1.7rem);
  background:
    linear-gradient(95deg, #e7faf6 0%, #e7faf6f5 32%, #d5f8f3a6 59%, #81e2df15 100%),
    url('assets/pool-floor.png?v=b3a6768be720') right 42% / cover;
  border-bottom: 3px solid var(--bright);
}

.game-header h1 {
  margin: 0;
  font: italic 700 clamp(3rem, 5.65vw, 4.8rem)/.92 "Barlow Condensed", system-ui, sans-serif;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
}

.game-header p {
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.35;
  margin: .43rem 0 0;
  font-weight: 650;
}

.wordmark {
  display: block;
  width: clamp(7rem, 14vw, 10.5rem);
  max-width: 43%;
  height: auto;
  mix-blend-mode: multiply;
}

.game {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: .87rem;
  background: var(--paper);
  box-shadow: 0 4px 0 #2d707324, 0 13px 32px #143e511b;
}

.game-tools {
  display: grid;
  grid-template-columns: minmax(9rem, .85fr) minmax(0, 1.55fr) minmax(max-content, .9fr) auto;
  align-items: center;
  gap: .65rem clamp(1rem, 2.55vw, 2.2rem);
  padding: .75rem clamp(.8rem, 2.4vw, 1.5rem);
  background: var(--board);
  color: var(--paper);
}
.level-meter {
  display: grid;
  align-content: center;
  gap: .12rem;
  min-height: 2.8rem;
  padding-inline-start: .72rem;
  border-inline-start: 3px solid var(--bright);
}
.level-meter span { color: #c8e8ee; font-size: .94rem; line-height: 1.1; }
.level-meter strong { font: 700 1.5rem/1 "Barlow Condensed", system-ui, sans-serif; }
.meter-label { display: flex; justify-content: space-between; align-items: baseline; gap: .4rem; }
.meter-label label, .debris-meter dt { color: #c8e8ee; font-size: 1rem; line-height: 1.25; }
.meter-label strong, .debris-meter dd {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.clean-meter progress {
  display: block;
  height: .5rem;
  width: 100%;
  margin-top: .32rem;
  appearance: none;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: #325c70;
}
.clean-meter progress::-webkit-progress-bar { background: #325c70; }
.clean-meter progress::-webkit-progress-value { background: var(--bright); border-radius: 999px; }
.clean-meter progress::-moz-progress-bar { background: var(--bright); border-radius: 999px; }
.debris-meter { display: flex; align-items: baseline; flex-wrap: wrap; gap: .28rem .52rem; margin: 0; }
.game-tools button, .completion button {
  min-height: 44px;
  border: 1px solid #a2c2ca;
  border-radius: .38rem;
  background: #f1f8f8;
  padding: .35rem .85rem;
  font-weight: 700;
  cursor: pointer;
}
.game-tools button:hover { background: #deeff1; }
.game-tools button { color: var(--ink); }
.game-tools button:disabled { cursor: wait; }
.game-times {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem clamp(.9rem, 3vw, 2.5rem);
  margin: 0;
  padding: .43rem clamp(.8rem, 2.4vw, 1.5rem);
  border-block: 1px solid #b6e1df;
  background: #e3f8f5;
  font-size: .95rem;
  line-height: 1.32;
}
.game-times div { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .55rem; }
.game-times dt, .game-times dd { margin: 0; }
.game-times dt { color: var(--muted); }
.game-times dd { font-weight: 750; font-variant-numeric: tabular-nums; }
#record-time { color: #005e69; }

.water {
  position: relative;
  isolation: isolate;
  border-bottom: 3px solid #0d6074;
  background: #49604b url('assets/pool-sediment.png') center / cover;
}
#pool {
  display: block;
  width: 100%;
  height: clamp(21rem, 52vw, 39rem);
  touch-action: none;
  user-select: none;
  cursor: grab;
}
#pool[data-vacuuming="true"] { cursor: grabbing; }
#pool:focus-visible:not([data-pointer-focus="true"]) {
  outline: 3px solid #fff;
  outline-offset: -6px;
  box-shadow: inset 0 0 0 9px #113c51;
}

.surface-note {
  position: absolute;
  bottom: .85rem;
  left: 50%;
  translate: -50% 0;
  width: max-content;
  max-width: calc(100% - 2rem);
  margin: 0;
  padding: .38rem .8rem;
  border: 1px solid #f4ffff6e;
  border-radius: 999px;
  color: #fff;
  background: #0a3046e8;
  font-size: 1rem;
  text-align: center;
  line-height: 1.35;
  pointer-events: none;
}

.completion {
  position: absolute;
  z-index: 1;
  inset: 50% auto auto 50%;
  display: grid;
  justify-items: center;
  gap: .6rem;
  translate: -50% -50%;
  width: max-content;
  max-width: calc(100% - 2rem);
  padding: .92rem 1.2rem;
  border: 1px solid #c1e9ec;
  border-radius: .5rem;
  background: #08344bf5;
  color: #fff;
  text-align: center;
  box-shadow: 0 12px 30px #08344b4a;
}
.completion[hidden] { display: none; }
.completion strong { font: 700 2rem/1 "Barlow Condensed", system-ui, sans-serif; }
.completion p { margin: 0; color: #deeff2; }
.completion button { margin-top: .18rem; color: var(--ink); }
button:focus-visible, .back-to-site:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.game-tools button:focus-visible, .completion button:focus-visible { outline-color: #fff; }

.game-controls {
  padding: .6rem clamp(.8rem, 2.4vw, 1.5rem);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}
.game-controls p { margin: 0; }
#level-tip { margin-top: .16rem; color: var(--ink); font-weight: 650; }
.no-game { margin: 0; padding: .7rem; }
.screen-reader {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 42rem) {
  .workbench { width: calc(100% - 1.4rem); padding-top: .7rem; }
  .game-header {
    background-image:
      linear-gradient(96deg, #e7faf6 1%, #e7faf6ec 48%, #d5f8f380 100%),
      url('assets/pool-floor.png?v=b3a6768be720');
  }
  .game-header h1 { font-size: clamp(2.8rem, 9.5vw, 3.7rem); }
  .game-tools { grid-template-columns: minmax(0, 1fr) auto; gap: .58rem .95rem; }
  .level-meter { grid-column: 1; grid-row: 1; }
  .game-tools button { grid-column: 2; grid-row: 1; }
  .clean-meter { grid-column: 1; grid-row: 2; }
  .debris-meter {
    grid-column: 2;
    grid-row: 2;
    display: grid;
    justify-items: end;
    gap: .08rem;
    text-align: right;
  }
  #pool { height: auto; aspect-ratio: 1.14; }
}
