:root {
  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 {
  margin: 0;
  background: var(--ink);
  color: #fff;
  font-family: "Arial Narrow", "DIN Condensed", "Roboto Condensed", "Microsoft YaHei", sans-serif;
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.screen {
  position: relative;
  display: grid;
  width: 100vw;
  height: 100vh;
  min-height: 480px;
  grid-template-rows: 20vh 1fr;
  isolation: isolate;
  overflow: hidden;
  background: #020806 url("/assets/lounge-background.png") center / cover no-repeat;
}

.screen::before {
  position: absolute;
  z-index: -2;
  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: "";
}

.ambient {
  position: absolute;
  z-index: -1;
  right: 0;
  bottom: 0;
  left: 0;
  height: 14vh;
  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: 4vh;
}

.brand-lockup > img {
  width: clamp(120px, 20vh, 215px);
  height: clamp(120px, 20vh, 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.9vh 0 0;
  color: #f2e6ca;
  font-size: clamp(16px, 1.7vw, 31px);
  font-weight: 800;
  letter-spacing: .09em;
  line-height: 1.15;
}

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

.brand-lockup p strong {
  max-width: 38vw;
  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.6vw;
  width: min(96vw, 1760px);
  height: 73vh;
  margin: -2.2vh auto 8.8vh;
}

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

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

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

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

.level-panel strong {
  margin-top: .5vh;
  color: var(--gold-bright);
  font-family: "Arial Narrow", "DIN Condensed", sans-serif;
  font-size: clamp(110px, 15vw, 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(63vw, 102vh);
  height: min(67vh, 630px);
  place-items: center;
  justify-self: center;
  transform: translateY(-2vh);
}

.timer-ring-asset {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  width: min(62vw, 98vh);
  height: min(62vw, 98vh);
  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(49vw, 78vh);
  height: min(47vw, 74vh);
  place-items: center;
  transform: translateY(-5vh);
}

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

.clock-content strong {
  color: #f5f3ee;
  font-family: "Arial Narrow", "DIN Condensed", sans-serif;
  font-size: clamp(160px, 22vw, 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: scaleX(.78);
}

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

.scores {
  display: grid;
  align-self: start;
  width: 100%;
  min-height: 13vh;
  padding-top: 1.3vh;
  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;
  justify-items: center;
}

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

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

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

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

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

.waiting-message {
  width: 130%;
}

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

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

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

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

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

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

.level-up-message strong {
  font-size: clamp(76px, 7.2vw, 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.4vh;
  color: #f1d58f;
  font-size: clamp(16px, 1.4vw, 26px);
  font-weight: 800;
  letter-spacing: .16em;
}

.finished-emblem {
  position: relative;
  display: grid;
  width: min(42vw, 68vh);
  height: min(26vw, 41vh);
  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(12vw, 19vh);
  height: min(12vw, 19vh);
  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: .5vh;
  font-size: clamp(56px, 5vw, 96px);
}

.finished-message > span {
  margin-top: .7vh;
  font-size: clamp(22px, 1.8vw, 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(54vw, 83vh);
}

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

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

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

.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(51vw, 82vh);
  height: min(46vw, 68vh);
  transform: translateY(17vh);
}

.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(62vw, 98vh);
  height: min(62vw, 98vh);
  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(-5vh);
}

.connection strong {
  color: #f5f3ee;
  font-family: "Arial Narrow", "DIN Condensed", sans-serif;
  font-size: clamp(160px, 22vw, 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: scaleX(.78);
}

.connection span {
  margin-top: -2vh;
  color: #71f1dc;
  font-size: clamp(16px, 1.5vw, 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: 3vh;
  left: 50%;
  padding: 1.1vh 2vw;
  border: 1px solid #d9b45b;
  border-radius: 5px;
  background: rgba(9, 11, 8, .92);
  color: #f2d487;
  font-size: clamp(14px, 1.3vw, 24px);
  transform: translateX(-50%);
}

.sound-button,
.fullscreen-button {
  position: absolute;
  z-index: 12;
  top: 2vh;
  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: 2vw;
}

.fullscreen-button {
  right: 2vw;
}

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

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

  .timer-stage {
    width: min(66vw, 96vh);
  }

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

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

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

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

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

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

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

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

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