*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  background: #1b3042;
  color: #f7f1e8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow: visible;
}

body {
  position: relative;
  min-height: 100vh;
}

#boot {
  position: relative;
  z-index: 5;
  box-sizing: border-box;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #1b3042;
  color: #f7f1e8;
}

#app {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  width: 100%;
  height: 100vh;
  min-height: 480px;
  overflow: hidden;
  background: #1b3042;
}

#field {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #2a4a5c;
  touch-action: none;
}

#ui {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  pointer-events: none;
}

.center-layer {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(8px + env(safe-area-inset-top))
    calc(16px + env(safe-area-inset-right))
    calc(8px + env(safe-area-inset-bottom))
    calc(16px + env(safe-area-inset-left));
  pointer-events: none;
}

.card {
  width: min(520px, 100%);
  max-height: 100%;
  overflow: auto;
  background: #243e52;
  color: #f7f1e8;
  border-radius: 28px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  pointer-events: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.card.dialog {
  width: min(440px, 100%);
  max-height: min(560px, 100%);
  padding: 28px 24px;
  gap: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 40px;
  line-height: 48px;
  font-weight: 600;
  text-align: center;
}

h2 {
  font-size: 32px;
  line-height: 40px;
  font-weight: 600;
  text-align: center;
}

.hint,
.end-copy {
  font-size: 22px;
  line-height: 30px;
  text-align: center;
}

.hud {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding:
    calc(8px + env(safe-area-inset-top))
    calc(12px + env(safe-area-inset-right))
    0
    calc(12px + env(safe-area-inset-left));
  pointer-events: none;
}

.score {
  margin: 0;
  background: #243e52;
  color: #f7f1e8;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.2;
  border-radius: 16px;
  padding: 12px 16px;
  pointer-events: none;
}

.hud-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  margin-left: auto;
  pointer-events: none;
}

.badge {
  background: #243e52;
  color: #f7f1e8;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 20px;
  padding: 16px 28px;
  pointer-events: none;
}

.scrim {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(27, 48, 66, 0.902);
  pointer-events: auto;
}

#paused-layer {
  z-index: 1;
}

#ended {
  z-index: 5;
}

.btn-wrap {
  display: inline-flex;
  border: 4px solid transparent;
  border-radius: 32px;
  padding: 6px;
  pointer-events: auto;
}

.btn-wrap.block {
  display: flex;
  width: 100%;
}

.btn-wrap:has(button:focus-visible) {
  border-color: #f0c14d;
}

button.calm {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  background: #f7f1e8;
  color: #1a2e3b;
  border: 2px solid #1a2e3b;
  border-radius: 24px;
  font-family: inherit;
  font-weight: 600;
  font-size: 22px;
  line-height: 1.2;
  text-align: center;
  min-width: 148px;
  min-height: 72px;
  padding: 12px 18px;
  touch-action: manipulation;
  cursor: pointer;
}

.btn-wrap.block button.calm {
  width: 100%;
}

button.calm.start {
  min-width: 220px;
  min-height: 88px;
  font-size: 34px;
}

button.calm.dialog-action {
  min-width: 220px;
  min-height: 80px;
  font-size: 28px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
