@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;700;800&family=Zen+Kaku+Gothic+New:wght@500;700;900&display=swap');
:root {
  --ink: #101719;
  --paper: #fffbe9;
  --lime: #d5ff37;
  --red: #ff4b3e;
  --cyan: #27c8eb;
  --green: #6bd56a;
  --yellow: #ffd638;
  --orange: #ff9b3e;
  --scarlet: #f25a64;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #152528;
  color: var(--ink);
  font-family: 'Zen Kaku Gothic New', sans-serif;
}
.board-screen {
  min-height: 100vh;
  padding: calc(120px + 18px) clamp(14px, 3vw, 48px) 18px;
  background:
    linear-gradient(120deg, rgba(10, 20, 15, 0.82), rgba(20, 40, 25, 0.72)),
    url('/photo/daibutuden.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  overflow: hidden;
  transition: box-shadow 0.4s ease;
}
.board-screen.urgent {
  animation: urgent-flash 0.6s steps(2, jump-none) infinite;
}
.result-banner {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font: 900 clamp(70px, 15vw, 220px) 'Barlow Condensed';
  line-height: 0.85;
  letter-spacing: 4px;
  pointer-events: none;
  -webkit-text-stroke: 10px #fff;
  paint-order: stroke fill;
}
.result-banner.over {
  background: linear-gradient(180deg, #fff1c8 0%, #ff5a3c 45%, #b3161c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(10px 10px 0 var(--ink));
}
.result-banner.clear {
  background: linear-gradient(180deg, #eaffff 0%, #4fd0ff 45%, #0a63a8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(10px 10px 0 var(--ink));
}
@keyframes urgent-flash {
  0%,
  100% {
    box-shadow: inset 0 0 0 0 rgba(255, 60, 40, 0);
  }
  50% {
    box-shadow: inset 0 0 120px 20px rgba(255, 60, 40, 0.55);
  }
}
.topbar {
  position: fixed;
  top: 10px;
  right: 16px;
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 12px;
}
.timer {
  font: 800 clamp(34px, 5.5vw, 64px) 'Barlow Condensed';
  color: var(--paper);
  background: var(--ink);
  padding: 8px 20px;
  border: 4px solid var(--lime);
  box-shadow: 5px 5px 0 var(--lime);
}
.fullscreen-toggle {
  padding: 9px 12px;
  color: var(--paper);
  background: var(--ink);
  border: 3px solid var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
  white-space: nowrap;
}
.fullscreen-toggle:hover,
.fullscreen-toggle:focus-visible {
  color: var(--ink);
  background: var(--lime);
  outline: none;
}
.fullscreen-start {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(16, 23, 25, 0.82);
}
.fullscreen-start button {
  padding: 22px 36px;
  color: var(--ink);
  background: var(--lime);
  border: 5px solid var(--paper);
  box-shadow: 8px 8px 0 var(--paper);
  font-size: clamp(24px, 4vw, 42px);
  font-weight: 900;
}
.fullscreen-start button:hover,
.fullscreen-start button:focus-visible {
  color: var(--paper);
  background: var(--red);
  outline: 3px solid var(--lime);
  outline-offset: 5px;
}
.question-panel {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(85%, 1300px);
  height: 120px;
  margin: 0;
  max-width: none;
  padding: 20px 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(100deg, #ffb328, #fff37c);
  border: 6px solid var(--ink);
  font-size: clamp(18px, 2.8vw, 34px);
  font-weight: 900;
  text-align: center;
  overflow: auto;
  z-index: 10;
}
.image-question {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  padding: 12px;
}
.question-image {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 4px solid var(--ink);
  background: #fff;
}
.question-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.target-panel {
  position: fixed;
  top: 150px;
  right: clamp(14px, 3vw, 48px);
  z-index: 9;
  display: grid;
  grid-template-columns: repeat(2, minmax(84px, 1fr));
  gap: 8px;
  width: min(26vw, 320px);
  max-height: calc(100vh - 185px);
  padding: 12px;
  overflow: auto;
  background: linear-gradient(145deg, #fff37c, #ffb328);
  border: 6px solid var(--ink);
}
.target-panel .char-tile {
  position: relative;
  min-height: 64px;
  border: 4px solid var(--ink);
}
.check,
.hit {
  position: absolute;
  display: grid;
  place-items: center;
}
.check {
  top: 50%;
  left: 50%;
  width: min(42%, 58px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: clamp(4px, 0.5vw, 7px) solid var(--red);
  border-radius: 50%;
  background: rgba(255, 75, 62, 0.16);
  box-shadow: 0 0 0 3px #fff;
}
.lanes {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(5px, 1.6vw, 22px);
  max-width: 1150px;
  margin: 0 auto;
  height: calc(100vh - 156px);
  align-items: stretch;
}
.lane {
  position: relative;
  text-align: center;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.helmet {
  flex: 0 0 auto;
  margin-top: 8px;
  background: var(--ink);
  padding: 10px 4px;
  border: 4px solid var(--ink);
  clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%);
}
.tube {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  margin: 0 10% 14px;
  border: 6px solid var(--ink);
  border-top: 0;
  background: rgba(255, 255, 255, 0.55);
  overflow: visible;
}
.bar {
  position: absolute;
  z-index: 1;
  left: -10px;
  right: -10px;
  top: 36%;
  height: 13px;
  background: #dfe5dd;
  border: 5px solid var(--ink);
  box-shadow: 0 4px 0 #77807b;
  transition: top 1s linear;
  transform-origin: left center;
}
.bar.tilt-right {
  transform-origin: left center;
  animation: bar-tilt-right 0.6s ease-in-out;
}
.bar.tilt-left {
  transform-origin: right center;
  animation: bar-tilt-left 0.6s ease-in-out;
}
@keyframes bar-tilt-right {
  0% {
    transform: rotate(0deg);
  }
  35% {
    transform: rotate(22deg);
  }
  70% {
    transform: rotate(-8deg);
  }
  100% {
    transform: rotate(0deg);
  }
}
@keyframes bar-tilt-left {
  0% {
    transform: rotate(0deg);
  }
  35% {
    transform: rotate(-22deg);
  }
  70% {
    transform: rotate(8deg);
  }
  100% {
    transform: rotate(0deg);
  }
}
.progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.32);
  transition: height 1s linear;
}
.bomb {
  position: absolute;
  z-index: 2;
  left: -20%;
  right: -20%;
  width: 140%;
  transform: translateY(-50%);
  top: 0;
  aspect-ratio: 1;
  background: url('/photo/bomb.png') center / contain no-repeat;
  filter: drop-shadow(4px 4px 0 var(--ink));
  transition: top 1s linear;
}
.daibutu {
  position: absolute;
  top: 20%;
  right: 20%;
  bottom: 10%;
  left: 10%;
  width: 70%;
  height: 70%;
  object-fit: contain;
  pointer-events: none;
}
.urgent .bomb {
  animation: bomb-pulse 0.5s ease-in-out infinite;
  filter: drop-shadow(4px 4px 0 var(--ink)) drop-shadow(0 0 14px var(--red))
    sepia(1) saturate(6) hue-rotate(-50deg) brightness(0.95);
}
@keyframes bomb-pulse {
  0%,
  100% {
    transform: translateY(-50%) scale(1);
  }
  50% {
    transform: translateY(-50%) scale(1.25);
  }
}
.hit {
  font-size: 65px;
  top: auto;
  bottom: 20px;
}
.cyan .tube {
  background: linear-gradient(90deg, #8feaff, #eaffff, #55c4dc);
}
.green .tube {
  background: linear-gradient(90deg, #a9f7ad, #f0fff0, #62c86c);
}
.yellow .tube {
  background: linear-gradient(90deg, #fff0a0, #fffef0, #f5c946);
}
.orange .tube {
  background: linear-gradient(90deg, #ffd2a4, #fff4e5, #f39a4c);
}
.red .tube {
  background: linear-gradient(90deg, #ffb1b1, #fff0f0, #ed6672);
}
.answer-panel {
  position: fixed;
  bottom: 18px;
  left: 20px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--paper);
  border: 6px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  padding: 18px 24px;
  max-width: calc(60% - 40px);
}
.answer-slot {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: clamp(20px, 2vw, 30px);
  font-weight: 700;
}
.answer-slot-label {
  font: 800 clamp(18px, 1.6vw, 24px) 'Barlow Condensed';
  color: var(--red);
  min-width: 40px;
}
  min-width: 24px;
}
.admin-shell {
  min-height: 100vh;
  padding: clamp(22px, 5vw, 70px);
  background:
    radial-gradient(circle at 80% 0, #fff1a7, transparent 34%),
    linear-gradient(130deg, #d8f3bd, #f7c583 60%, #ec665e);
}
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  max-width: 1100px;
  margin: auto;
}
.eyebrow {
  font: 700 14px 'Barlow Condensed';
  letter-spacing: 3px;
}
.admin-header h1 {
  font-size: clamp(34px, 6vw, 72px);
  line-height: 0.9;
  margin: 12px 0 38px;
  letter-spacing: -2px;
}
.admin-header em {
  display: block;
  font: 700 17px 'Zen Kaku Gothic New';
  letter-spacing: 0;
  margin-top: 14px;
}
.view-link,
button {
  font: 700 15px 'Zen Kaku Gothic New';
  border: 3px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 12px 16px;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
  text-decoration: none;
}
.view-link {
  margin-bottom: 40px;
}
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 22px;
  max-width: 1100px;
  margin: auto;
}
.control-panel {
  background: rgba(255, 251, 233, 0.9);
  border: 4px solid var(--ink);
  padding: 24px;
  box-shadow: 8px 8px 0 var(--ink);
}
.control-panel h2 {
  font: 800 25px 'Barlow Condensed';
  letter-spacing: 3px;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 12px;
  margin: 0 0 20px;
}
.control-panel label {
  display: block;
  font-weight: 700;
  margin: 14px 0;
}
.control-panel input,
.control-panel textarea,
.control-panel select {
  width: 100%;
  padding: 11px;
  margin-top: 7px;
  border: 2px solid var(--ink);
  background: #fff;
  font: inherit;
}
.control-panel textarea {
  height: 110px;
  resize: vertical;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.readonly-value {
  display: block;
  margin-top: 7px;
  padding: 11px;
  border: 2px solid var(--ink);
  background: #f4f0d8;
  font-weight: 900;
}
.pending-banner {
  margin-top: 16px;
  padding: 10px 14px;
  border: 2px dashed var(--ink);
  background: #e9ffdb;
  font-size: 14px;
  font-weight: 700;
}
.active-question {
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 2px solid var(--ink);
  background: #fff3c4;
  font-size: 14px;
  font-weight: 700;
}

.question-preview {
  min-height: 60px;
  white-space: pre-wrap;
}
.char-tile {
  display: grid;
  place-items: center;
  font: 800 26px 'Barlow Condensed';
  background: #fff;
}
.primary {
  background: var(--lime);
  font-weight: 900;
}
.live .panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.live-dot {
  font: 700 13px 'Barlow Condensed';
  color: var(--red);
}
.big-time {
  text-align: center;
  font: 800 clamp(70px, 10vw, 120px)/1 'Barlow Condensed';
  margin: 20px 0;
}
.control-actions {
  display: flex;
  gap: 12px;
}
.control-actions button {
  flex: 1;
}
.judge {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 3px solid var(--ink);
}
.judge > div {
  display: flex;
  gap: 12px;
}
.judge button {
  flex: 1;
  font-size: 18px;
}
.correct {
  background: #9af08c;
}
.wrong {
  background: #ff8b80;
}
.answer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.answer-fields {
  flex-wrap: wrap;
}
.answer-fields label {
  flex: 1 1 45%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
}
.answer-fields input {
  padding: 6px 8px;
  border: 2px solid var(--ink);
  font-size: 15px;
}
.answer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 2px solid var(--ink);
  background: #fff;
}
.answer-label {
  font-weight: 700;
  font-size: 13px;
}
.answer-toggle {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid var(--ink);
  background: #c7c7c7;
}
.answer-toggle.status-correct {
  background: #4caf50;
}
.answer-toggle.status-wrong {
  background: #e53935;
}
.shift-control {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.shift-control button {
  flex: 0 0 auto;
  padding: 4px 10px;
  font-size: 13px;
  background: #e0e0e0;
}
.position-control {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 24px;
}
.position {
  padding: 7px 11px;
}
.position.selected {
  background: var(--red);
  color: #fff;
}
.admin-note {
  max-width: 1100px;
  margin: 28px auto;
  font-size: 14px;
}
.admin-note code {
  background: var(--ink);
  color: var(--lime);
  padding: 3px 6px;
}
@media (max-width: 760px) {
  .admin-header {
    display: block;
  }
  .view-link {
    display: inline-block;
    margin-bottom: 25px;
  }
  .admin-grid {
    grid-template-columns: 1fr;
  }
  .lanes {
    height: calc(100vh - 136px);
  }
  .helmet {
    padding: 6px 0;
  }
  .question-panel {
    width: min(94%, 700px);
    padding: 12px;
    height: 100px;
  }
  .target-panel {
    top: 112px;
    right: 3%;
    width: 94%;
    max-height: 92px;
    grid-template-columns: repeat(5, minmax(48px, 1fr));
    padding: 6px;
    gap: 5px;
  }
  .target-panel .char-tile {
    min-height: 54px;
    border-width: 3px;
  }
  .board-screen {
    padding-top: calc(100px + 18px);
  }
}
