@import url("https://fonts.googleapis.com/css2?family=Black+Han+Sans&family=Bungee&family=Russo+One&display=swap");

:root {
  --bg-deep: #060203;
  --bg-blood: #2a0506;
  --bg-ember: #7a1807;
  --panel-dark: rgba(10, 8, 10, 0.86);
  --panel-red: rgba(84, 8, 8, 0.82);
  --text: #fff3cf;
  --muted: #f7b86b;
  --flame: #ff4b12;
  --flame-hot: #ffcf48;
  --crimson: #d41414;
  --cyan: #38d8ff;
  --ink: #050505;
  --line: rgba(255, 185, 65, 0.55);
  --shadow-fire: 0 0 22px rgba(255, 75, 18, 0.55), 0 0 74px rgba(212, 20, 20, 0.36);
  --shadow-deep: 0 28px 90px rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg-deep);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 17%, rgba(255, 125, 35, 0.52) 0 7rem, transparent 22rem),
    radial-gradient(circle at 18% 30%, rgba(180, 13, 13, 0.42) 0 12rem, transparent 31rem),
    radial-gradient(circle at 82% 36%, rgba(255, 65, 13, 0.35) 0 10rem, transparent 30rem),
    linear-gradient(145deg, #020101 0%, var(--bg-blood) 43%, #120304 68%, #000 100%);
  font-family: "Black Han Sans", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
}

body::before {
  opacity: 0.55;
  background:
    linear-gradient(115deg, transparent 0 18%, rgba(255, 80, 10, 0.18) 19%, transparent 21% 53%, rgba(255, 212, 58, 0.1) 54%, transparent 56%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 90px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 86px);
  mix-blend-mode: screen;
}

body::after {
  background:
    radial-gradient(circle at center, transparent 0 42%, rgba(0, 0, 0, 0.64) 76%, rgba(0, 0, 0, 0.95) 100%),
    linear-gradient(rgba(255, 255, 255, 0.035) 50%, transparent 50%);
  background-size: auto, 100% 4px;
}

.app {
  width: min(1220px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 34px 0 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.app__header {
  position: relative;
  width: min(940px, 100%);
  padding: 10px 18px 0;
  text-align: center;
  text-transform: uppercase;
}

.app__header::before,
.app__header::after {
  position: absolute;
  top: 62%;
  width: min(22vw, 230px);
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--flame-hot), var(--flame), transparent);
  box-shadow: var(--shadow-fire);
  content: "";
}

.app__header::before {
  left: 0;
}

.app__header::after {
  right: 0;
  transform: scaleX(-1);
}

.app__header:has([data-ai-id="archery-scoreboard-page-header-eyebrow-text"][hidden]) {
  display: none;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--flame-hot);
  font-family: "Bungee", "Russo One", fantasy;
  font-size: clamp(0.8rem, 1.5vw, 1.12rem);
  font-weight: 400;
  letter-spacing: 0.14em;
  text-shadow:
    0 2px 0 #3a0503,
    0 0 16px rgba(255, 203, 72, 0.85),
    0 0 34px rgba(255, 75, 18, 0.75);
}

h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #fff4bd;
  font-size: clamp(2.8rem, 7vw, 6.8rem);
  line-height: 0.96;
  letter-spacing: 0.03em;
  text-shadow:
    0 5px 0 #4a0704,
    0 10px 0 #120101,
    0 0 18px rgba(255, 207, 72, 0.95),
    0 0 42px rgba(255, 47, 12, 0.9),
    0 0 90px rgba(190, 10, 10, 0.8);
  -webkit-text-stroke: 1px rgba(44, 0, 0, 0.55);
}

.image-only {
  width: min(760px, 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-box__image {
  display: block;
  width: 100%;
  max-height: min(62vh, 620px);
  object-fit: contain;
  filter:
    drop-shadow(0 0 18px rgba(255, 207, 72, 0.38))
    drop-shadow(0 0 42px rgba(255, 75, 18, 0.42))
    drop-shadow(0 24px 42px rgba(0, 0, 0, 0.78));
}

.score-grid {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 1.5vw, 18px);
}

.score-card {
  position: relative;
  min-height: 178px;
  padding: 18px 16px 20px;
  border: 3px solid transparent;
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(30, 4, 4, 0.96), rgba(4, 3, 4, 0.94)) padding-box,
    linear-gradient(135deg, rgba(255, 207, 72, 0.96), rgba(255, 75, 18, 0.85), rgba(56, 216, 255, 0.7)) border-box;
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.62),
    0 0 24px rgba(255, 75, 18, 0.27),
    inset 0 0 34px rgba(255, 75, 18, 0.13);
  display: grid;
  align-content: center;
  gap: 9px;
  text-align: center;
}

.score-card::before {
  position: absolute;
  inset: -45% -35% auto;
  height: 92px;
  background: linear-gradient(90deg, transparent, rgba(255, 207, 72, 0.23), transparent);
  pointer-events: none;
  content: "";
  transform: rotate(-18deg);
}

.score-card__label {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-family: "Bungee", "Russo One", sans-serif;
  font-size: clamp(0.68rem, 1vw, 0.84rem);
  font-weight: 400;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(255, 75, 18, 0.6);
}

.score-card__team-field {
  position: relative;
  z-index: 1;
  width: 100%;
}

.score-card__team {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 9px 16px 7px;
  border: 2px solid transparent;
  border-radius: 13px;
  color: #fff1b7;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  font-family: "Black Han Sans", "Apple SD Gothic Neo", sans-serif;
  font-size: clamp(1.2rem, 2vw, 1.62rem);
  font-weight: 900;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow:
    0 2px 0 #310302,
    0 0 12px rgba(255, 207, 72, 0.52);
}

.score-card__team--empty {
  color: transparent;
}

.score-card__team--empty:hover {
  background: rgba(255, 207, 72, 0.06);
  box-shadow: inset 0 0 14px rgba(255, 75, 18, 0.08);
}

.score-card__team--editing {
  color: #fff1b7;
  border-color: var(--cyan);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.74), rgba(12, 64, 76, 0.36)),
    rgba(4, 4, 4, 0.9);
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.85),
    0 0 24px rgba(56, 216, 255, 0.6),
    0 0 38px rgba(255, 75, 18, 0.32);
  cursor: text;
}

.score-card__team:focus {
  outline: none;
}

.score-card__team--editing:focus {
  outline: 4px solid rgba(56, 216, 255, 0.22);
}

.score-card__total {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  padding: 8px 8px 4px;
  border: 2px solid transparent;
  border-radius: 16px;
  color: #fff56b;
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  font-family: "Bungee", "Russo One", fantasy;
  font-size: clamp(2rem, 4vw, 3.4rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.02em;
  text-align: center;
  text-shadow:
    0 4px 0 #610805,
    0 8px 0 #090000,
    0 0 18px rgba(255, 207, 72, 0.95),
    0 0 34px rgba(255, 75, 18, 0.86);
}

.score-card__total:hover {
  background: rgba(255, 207, 72, 0.06);
  box-shadow: inset 0 0 14px rgba(255, 75, 18, 0.08);
}

.score-card__total:focus {
  border-color: var(--flame-hot);
  cursor: text;
  outline: 4px solid rgba(255, 207, 72, 0.18);
  background: rgba(255, 207, 72, 0.08);
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.58),
    0 0 22px rgba(255, 207, 72, 0.48),
    0 0 42px rgba(255, 75, 18, 0.32);
}

.score-card__total--invalid {
  border-color: var(--crimson);
  color: #ffdad4;
  outline: 4px solid rgba(212, 20, 20, 0.22);
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.7),
    0 0 24px rgba(212, 20, 20, 0.72);
}

@media (max-width: 880px) {
  .app__header::before,
  .app__header::after {
    display: none;
  }

  .score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .app {
    width: min(100% - 24px, 920px);
    padding: 24px 0 32px;
    justify-content: flex-start;
  }

  .score-grid {
    grid-template-columns: 1fr;
  }
}

.storage-reset {
  position: fixed;
  top: 50%;
  right: 0;
  z-index: 20;
  padding: 13px 10px 12px;
  border: 2px solid rgba(255, 207, 72, 0.78);
  border-right: 0;
  border-radius: 14px 0 0 14px;
  color: #fff4bd;
  background:
    linear-gradient(180deg, rgba(122, 24, 7, 0.94), rgba(18, 3, 4, 0.96)),
    var(--bg-blood);
  box-shadow:
    -8px 0 24px rgba(0, 0, 0, 0.48),
    0 0 22px rgba(255, 75, 18, 0.34);
  cursor: pointer;
  font-family: "Black Han Sans", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-shadow: 0 2px 0 #3a0503, 0 0 12px rgba(255, 207, 72, 0.58);
  transform: translateY(-50%);
  writing-mode: vertical-rl;
}

.storage-reset:hover {
  color: #fff56b;
  border-color: var(--flame-hot);
  background:
    linear-gradient(180deg, rgba(212, 20, 20, 0.95), rgba(42, 5, 6, 0.96)),
    var(--bg-blood);
  box-shadow:
    -8px 0 24px rgba(0, 0, 0, 0.48),
    0 0 28px rgba(255, 75, 18, 0.58);
}

.storage-reset:focus-visible {
  outline: 4px solid rgba(255, 207, 72, 0.24);
  outline-offset: 3px;
}

@media (max-width: 560px) {
  .storage-reset {
    top: auto;
    right: 10px;
    bottom: 10px;
    border: 2px solid rgba(255, 207, 72, 0.78);
    border-radius: 999px;
    font-size: 0.82rem;
    transform: none;
    writing-mode: horizontal-tb;
  }
}
