@import url('../../fonts/fonts.css');

:root {
  --ink: #151942;
  --paper: #d1d2d8;
  --frame: #d1d2d8;
  --zone-radius: 20px;
  --tap-flash: rgba(21, 25, 66, 0.22);
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-drag: none;
  touch-action: manipulation;
}

::selection {
  background: transparent;
  color: inherit;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--frame);
  font-family: 'Kippen', system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

main {
  width: min(430px, calc(100vw - 40px));
  height: min(900px, calc(100vh - 40px));
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  position: relative;
  width: 100%;
  height: 100%;
  container-type: inline-size;
  background: var(--paper);
  border: none;
  padding: 22px 18px;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  gap: 12px;
  overflow: hidden;
}

.card-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--ink);
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}

.section {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  --zone-frac: 0.5;
  --zone-width-frac: 0.97;
  --zone-inset: 2%;
  --zone-height: 50%;
  --zone-side-inset: 0px;
  --zone-width: 100%;
}

.life {
  position: relative;
  z-index: 2;
  font-family: 'Kippen Thin', 'Kippen', system-ui, sans-serif;
  font-weight: normal;
  font-size: clamp(88px, 42cqw, 160px);
  line-height: 1;
  pointer-events: none;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  -webkit-user-select: none;
  user-select: none;
}

.opponent .life {
  transform: rotate(180deg);
}

.tap-zone {
  position: absolute;
  left: var(--zone-side-inset);
  width: var(--zone-width);
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

.tap-zone.plus {
  top: var(--zone-inset);
  height: var(--zone-height);
  border-radius: var(--zone-radius) var(--zone-radius) 0 0;
}

.tap-zone.minus {
  bottom: var(--zone-inset);
  height: var(--zone-height);
  border-radius: 0 0 var(--zone-radius) var(--zone-radius);
}

.tap-flash {
  position: absolute;
  inset: 0;
  background: var(--tap-flash);
  opacity: 0;
  pointer-events: none;
  border-radius: inherit;
}

.tap-flash.show {
  opacity: 1;
  transition: none;
}

.tap-flash.fade {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.logo {
  width: min(80px, 40vw);
  height: min(80px, 40vw);
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.logo img {
  width: 80px;
  height: 80px;
  display: block;
}

.tutorial-text {
  position: absolute;
  font-family: 'Kippen', system-ui, sans-serif;
  font-size: 18px;
  font-weight: normal;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  animation: tutorial-fade-in 600ms ease forwards;
  animation-delay: 2s;
}

.tutorial-text.hidden {
  animation: tutorial-fade-out 800ms ease forwards;
}

.tutorial-text.top {
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
}

.tutorial-text.bottom {
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
}

@keyframes tutorial-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes tutorial-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@media (max-width: 420px) {
  main {
    width: calc(100vw - 30px);
    height: calc(100vh - 30px);
  }

  .card {
    padding: 14px 10px;
    gap: 10px;
  }
}
