:root {
  --display-scale: 1;
  color-scheme: dark;
  --gold: #d6a746;
  --gold-bright: #f4c962;
  --emerald: #25dfad;
  --amber: #ffb126;
  --red: #ff3d25;
  --cyan: #42e6e5;
  --silver: #eef2ef;
  --ink: #020705;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  position: relative;
  display: grid;
  margin: 0;
  place-items: center;
  background: #020806 url("/assets/lounge-background.png") center / cover no-repeat;
  color: #fff;
  font-family: "Arial Narrow", "DIN Condensed", "Roboto Condensed", "Microsoft YaHei", sans-serif;
}

body::before {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 43%, rgba(3, 29, 20, .1) 0, rgba(1, 9, 7, .32) 44%, rgba(0, 4, 3, .72) 100%),
    linear-gradient(180deg, rgba(0, 5, 4, .1), rgba(0, 9, 6, .42));
  content: "";
  pointer-events: none;
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.screen {
  position: relative;
  display: grid;
  width: 100vw;
  height: 100vh;
  min-height: 480px;
  grid-template-rows: 20% 1fr;
  container-type: size;
  isolation: isolate;
  overflow: hidden;
  background: transparent;
}

.screen::before {
  display: none;
}

.ambient {
  position: absolute;
  z-index: -1;
  right: 0;
  bottom: 0;
  left: 0;
  height: 14cqh;
  border-top: 1px solid rgba(201, 143, 34, .78);
  background:
    linear-gradient(180deg, rgba(0, 13, 9, .12), rgba(1, 35, 23, .72)),
    radial-gradient(ellipse at 50% 110%, rgba(9, 84, 54, .52), transparent 66%);
  box-shadow: 0 -20px 60px rgba(1, 21, 14, .52);
  transform: perspective(450px) rotateX(2deg);
}

.brand-lockup {
  position: relative;
  z-index: 5;
  display: grid;
  align-content: start;
  justify-items: center;
  padding-top: 4cqh;
}

.brand-lockup > img {
  width: clamp(120px, 20cqh, 215px);
  height: clamp(120px, 20cqh, 215px);
  object-fit: contain;
  border-radius: 50%;
  clip-path: circle(49%);
  filter: drop-shadow(0 0 12px rgba(236, 172, 45, .22));
  mix-blend-mode: screen;
}

.brand-lockup p {
  display: flex;
  align-items: baseline;
  gap: .55em;
  margin: 1.9cqh 0 0;
  color: #f2e6ca;
  font-size: clamp(16px, 1.7cqw, 31px);
  font-weight: 800;
  letter-spacing: .09em;
  line-height: 1.15;
}

.brand-lockup p span {
  letter-spacing: .11em;
}

.brand-lockup p strong {
  max-width: 38cqw;
  overflow: hidden;
  color: inherit;
  font-size: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timer-layout {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(165px, 1fr) minmax(620px, 2.35fr) minmax(165px, 1fr);
  align-items: center;
  gap: 1.6cqw;
  width: min(96cqw, 1760px);
  height: 73cqh;
  margin: -2.2cqh auto 8.8cqh;
}

.level-panel {
  display: grid;
  align-content: center;
  color: var(--gold);
  transform: translateY(2cqh);
}

.current-panel {
  justify-items: start;
  padding-left: 7cqw;
  text-align: left;
}

.next-panel {
  justify-items: end;
  padding-right: 7cqw;
  text-align: right;
}

.next-panel.is-final-level strong {
  margin-top: 1.5cqh;
  padding: .45em .62em .5em;
  border: 1px solid rgba(225, 184, 84, .62);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(225, 184, 84, .13), rgba(225, 184, 84, .04));
  box-shadow: inset 0 0 18px rgba(225, 184, 84, .06), 0 4px 18px rgba(0, 0, 0, .3);
  font-family: inherit;
  font-size: clamp(28px, 2.4cqw, 46px);
  font-weight: 900;
  letter-spacing: .08em;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .8);
  white-space: nowrap;
}

.level-panel span {
  color: #e1b854;
  font-size: clamp(18px, 2cqw, 36px);
  font-weight: 900;
  letter-spacing: .08em;
  text-shadow: 0 2px 10px #000;
}

.level-panel strong {
  margin-top: .5cqh;
  color: var(--gold-bright);
  font-family: "Arial Narrow", "DIN Condensed", sans-serif;
  font-size: clamp(110px, 15cqw, 260px);
  font-stretch: condensed;
  font-weight: 500;
  letter-spacing: -.06em;
  line-height: .85;
  text-shadow: 0 4px 24px rgba(201, 143, 33, .34);
}

.timer-stage {
  position: relative;
  display: grid;
  width: min(63cqw, 102cqh);
  height: min(67cqh, 630px);
  place-items: center;
  justify-self: center;
  transform: translateY(-2cqh);
}

.timer-ring-asset {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  width: min(62cqw, 98cqh);
  height: min(62cqw, 98cqh);
  object-fit: contain;
  pointer-events: none;
  transform: translate(-50%, -50%);
  filter:
    sepia(1)
    saturate(4.5)
    hue-rotate(98deg)
    brightness(1.05)
    drop-shadow(0 0 8px rgba(23, 224, 162, .92))
    drop-shadow(0 0 25px rgba(16, 184, 132, .44));
  opacity: .98;
}

.timer-core {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: min(49cqw, 78cqh);
  height: min(47cqw, 74cqh);
  place-items: center;
  transform: translateY(-5cqh);
}

.clock-content,
.state-message {
  display: grid;
  align-self: end;
  justify-items: center;
  width: 100%;
  padding-bottom: 1.2cqh;
  text-align: center;
}

.clock-content strong {
  color: #f5f3ee;
  font-family: "Arial Narrow", "DIN Condensed", sans-serif;
  font-size: clamp(160px, 22cqw, 370px);
  font-stretch: condensed;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -.065em;
  line-height: .78;
  text-shadow: 0 4px 16px rgba(0, 0, 0, .86);
  transform: translateX(-.022em) scaleX(.78);
  transform-origin: center;
}

.clock-content span {
  min-height: 1.2em;
  margin-top: 1.5cqh;
  color: var(--emerald);
  font-size: clamp(17px, 1.85cqw, 34px);
  font-weight: 900;
  letter-spacing: .3em;
  line-height: 1;
  text-shadow: 0 0 16px currentColor;
}

.scores {
  display: grid;
  align-self: start;
  column-gap: clamp(14px, 1.2cqw, 26px);
  width: 100%;
  min-height: 13cqh;
  padding-top: 1.3cqh;
  border-top: 1px solid rgba(198, 132, 26, .74);
  background: linear-gradient(180deg, rgba(1, 14, 10, .72), rgba(1, 9, 7, 0));
}

.scores.two-columns {
  grid-template-columns: repeat(2, 1fr);
}

.scores.three-columns {
  grid-template-columns: repeat(3, 1fr);
}

.score-item {
  display: grid;
  min-width: 0;
  padding-inline: clamp(4px, .45cqw, 9px);
  justify-items: center;
  overflow: hidden;
}

.score-item span {
  color: #e5ba56;
  font-size: clamp(16px, 1.7cqw, 31px);
  font-weight: 900;
  letter-spacing: .05em;
  line-height: 1;
  white-space: nowrap;
}

.score-item strong {
  margin-top: .25cqh;
  color: var(--gold-bright);
  font-family: "Arial Narrow", "DIN Condensed", sans-serif;
  font-size: clamp(72px, 11cqw, 190px);
  font-stretch: condensed;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: -.04em;
  line-height: .9;
  white-space: nowrap;
}

.state-message {
  align-self: center;
  padding: 0;
}

.state-message strong {
  color: var(--gold-bright);
  font-size: clamp(50px, 4.6cqw, 87px);
  letter-spacing: .07em;
  line-height: 1.1;
  text-shadow: 0 4px 22px rgba(0, 0, 0, .8);
}

.state-message > span {
  margin-top: 1.4cqh;
  color: #e7bd5e;
  font-size: clamp(17px, 1.5cqw, 29px);
  font-weight: 800;
  letter-spacing: .18em;
}

.waiting-message {
  width: 130%;
}

.waiting-message strong {
  font-size: clamp(56px, 5cqw, 96px);
}

.state-waiting .timer-core {
  transform: translateY(5cqh);
}

.state-waiting .waiting-message {
  transform: translateY(4cqh);
}

.level-up-burst {
  position: absolute;
  z-index: 1;
  top: 49%;
  left: 50%;
  width: min(68cqw, 108cqh);
  height: min(63cqh, 680px);
  object-fit: contain;
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: .88;
  mix-blend-mode: screen;
}

.level-up-message {
  width: 145%;
  transform: translateY(7cqh);
}

.level-up-message > span {
  margin: 0 0 1.4cqh;
  color: #f1d58f;
  font-size: clamp(13px, 1cqw, 19px);
  letter-spacing: .35em;
}

.level-up-message strong {
  font-size: clamp(76px, 7.2cqw, 137px);
  letter-spacing: .12em;
  background: linear-gradient(180deg, #fff1b8 0%, #eab449 46%, #b86b16 100%);
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 5px 7px rgba(0, 0, 0, .72));
}

.level-up-message small {
  margin-top: 1.4cqh;
  color: #f1d58f;
  font-size: clamp(16px, 1.4cqw, 26px);
  font-weight: 800;
  letter-spacing: .16em;
}

.finished-emblem {
  position: relative;
  display: grid;
  width: min(42cqw, 68cqh);
  height: min(26cqw, 41cqh);
  place-items: center;
}

.finished-emblem .finished-laurel {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.finished-emblem img:last-child {
  position: relative;
  z-index: 1;
  width: min(12cqw, 19cqh);
  height: min(12cqw, 19cqh);
  object-fit: contain;
  border-radius: 50%;
  clip-path: circle(49%);
  filter: drop-shadow(0 0 20px rgba(220, 156, 38, .3));
  mix-blend-mode: screen;
}

.finished-message strong {
  margin-top: .5cqh;
  font-size: clamp(56px, 5cqw, 96px);
}

.finished-message > span {
  margin-top: .7cqh;
  font-size: clamp(22px, 1.8cqw, 34px);
}

.state-warning .timer-ring-asset {
  filter:
    sepia(1)
    saturate(6)
    hue-rotate(342deg)
    brightness(1.14)
    drop-shadow(0 0 8px rgba(255, 172, 27, .95))
    drop-shadow(0 0 26px rgba(245, 147, 9, .5));
}

.state-warning .clock-content strong,
.state-warning .clock-content span {
  color: var(--amber);
}

.state-critical .timer-ring-asset {
  filter:
    sepia(1)
    saturate(8)
    hue-rotate(308deg)
    brightness(.98)
    drop-shadow(0 0 9px rgba(255, 55, 35, .95))
    drop-shadow(0 0 27px rgba(255, 48, 28, .52));
}

.state-critical .clock-content strong,
.state-critical .clock-content span {
  color: var(--red);
}

.state-paused .timer-ring-asset {
  filter:
    grayscale(1)
    brightness(1.18)
    drop-shadow(0 0 8px rgba(236, 240, 238, .78))
    drop-shadow(0 0 24px rgba(207, 220, 218, .28));
}

.state-paused .clock-content span {
  color: var(--silver);
  text-shadow: none;
}

.state-break .timer-ring-asset {
  filter:
    sepia(1)
    saturate(7)
    hue-rotate(126deg)
    brightness(1.16)
    drop-shadow(0 0 8px rgba(64, 228, 229, .9))
    drop-shadow(0 0 26px rgba(33, 206, 207, .45));
}

.state-break .clock-content strong,
.state-break .clock-content span {
  color: var(--cyan);
}

.state-waiting .timer-ring-asset,
.state-levelup .timer-ring-asset,
.state-finished .timer-ring-asset {
  display: none;
}

.state-waiting .timer-core {
  width: min(54cqw, 83cqh);
}

.state-waiting .scores {
  width: 72%;
}

.state-levelup .timer-core {
  width: min(50cqw, 82cqh);
  height: min(42cqw, 66cqh);
}

.state-levelup .scores {
  transform: translateY(-8cqh);
}

.state-finished .timer-layout {
  grid-template-columns: 1fr minmax(620px, 2.35fr) 1fr;
}

.state-finished .level-panel,
.state-finished .scores {
  visibility: hidden;
}

.state-finished .timer-core {
  width: min(51cqw, 82cqh);
  height: min(46cqw, 68cqh);
  transform: translateY(17cqh);
}

.connection {
  position: absolute;
  z-index: 7;
  display: grid;
  inset: 0;
  place-items: center;
  text-align: center;
}

.connection::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: rgba(1, 9, 7, .08);
  content: "";
}

.connection > img {
  position: absolute;
  width: min(62cqw, 98cqh);
  height: min(62cqw, 98cqh);
  object-fit: contain;
  filter: drop-shadow(0 0 15px rgba(70, 232, 222, .4));
}

.connection > div {
  display: grid;
  z-index: 1;
  justify-items: center;
  transform: translateY(-5cqh);
}

.connection strong {
  color: #f5f3ee;
  font-family: "Arial Narrow", "DIN Condensed", sans-serif;
  font-size: clamp(160px, 22cqw, 370px);
  font-stretch: condensed;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.065em;
  line-height: .8;
  text-shadow: 0 4px 16px rgba(0, 0, 0, .86);
  transform: translateX(-.022em) scaleX(.78);
  transform-origin: center;
}

.connection span {
  margin-top: -2cqh;
  color: #71f1dc;
  font-size: clamp(16px, 1.5cqw, 28px);
  font-weight: 900;
  letter-spacing: .16em;
  text-shadow: 0 0 16px rgba(70, 232, 222, .72);
}

.state-reconnecting .timer-ring-asset,
.state-reconnecting .clock-content {
  visibility: hidden;
}

.notice {
  position: absolute;
  z-index: 10;
  bottom: 3cqh;
  left: 50%;
  padding: 1.1cqh 2cqw;
  border: 1px solid #d9b45b;
  border-radius: 5px;
  background: rgba(9, 11, 8, .92);
  color: #f2d487;
  font-size: clamp(14px, 1.3cqw, 24px);
  transform: translateX(-50%);
}

.sound-button,
.fullscreen-button {
  position: absolute;
  z-index: 12;
  top: 2cqh;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(226, 190, 98, .34);
  border-radius: 4px;
  background: rgba(2, 9, 6, .56);
  color: rgba(229, 202, 131, .76);
  cursor: pointer;
  opacity: .58;
  transition: opacity .18s ease;
}

.sound-button:hover,
.fullscreen-button:hover {
  opacity: 1;
}

.sound-button {
  left: 2cqw;
}

.fullscreen-button {
  right: 2cqw;
}

.sound-button.enabled {
  border-color: rgba(124, 230, 196, .55);
  color: #7ce6c4;
}

@media (min-width: 761px) {
  .screen {
    width: 1440px;
    height: 844px;
    min-height: 0;
    transform: scale(var(--display-scale));
    transform-origin: center;
  }
}

@media (max-aspect-ratio: 4 / 3) {
  .timer-layout {
    grid-template-columns: minmax(130px, 1fr) minmax(480px, 2.4fr) minmax(130px, 1fr);
    gap: .2cqw;
    width: 99cqw;
  }

  .timer-stage {
    width: min(66cqw, 96cqh);
  }

  .timer-ring-asset,
  .connection > img {
    width: min(55cqw, 70cqh);
    height: min(55cqw, 70cqh);
  }
}

@media (max-width: 760px) {
  .screen {
    min-height: 430px;
    grid-template-rows: 15% 1fr;
  }

  .brand-lockup {
    padding-top: .5cqh;
  }

  .brand-lockup > img {
    width: 54px;
    height: 54px;
  }

  .timer-layout {
    grid-template-columns: 1fr 1fr;
    align-content: center;
    height: 79cqh;
    margin-bottom: 6cqh;
  }

  .timer-stage {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 98cqw;
    height: 60cqh;
  }

  .level-panel {
    z-index: 6;
    grid-row: 2;
    min-height: 70px;
    padding: 0 7cqw;
    transform: translateY(-4cqh);
  }

  .timer-ring-asset,
  .connection > img {
    width: min(85cqw, 62cqh);
    height: min(85cqw, 62cqh);
  }

  .timer-core {
    width: min(74cqw, 56cqh);
    height: min(70cqw, 53cqh);
  }
}
