@import url("https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;700;800&family=Bungee&display=swap");

* {
  box-sizing: border-box;
}

:root {
  --bg-top: #82d6ff;
  --bg-mid: #9de7c8;
  --bg-bottom: #ffe6a1;
  --ink: #1f2f3f;
  --card: rgba(255, 255, 255, 0.92);
  --line: #95c3e2;
  --brand: #ff8f29;
  --brand-deep: #f06f00;
  --mint: #27c79e;
  --warn: #ff5c52;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Baloo 2", "Comic Sans MS", cursive;
  background: linear-gradient(150deg, var(--bg-top) 0%, var(--bg-mid) 42%, var(--bg-bottom) 100%);
}

.sky-bubbles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.sky-bubbles::before,
.sky-bubbles::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0));
  animation: float-bubble 9s linear infinite;
}

.sky-bubbles::before {
  left: -80px;
  top: 20%;
}

.sky-bubbles::after {
  right: -60px;
  top: 55%;
  animation-duration: 11s;
}

.app-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 16px 40px;
  display: grid;
  gap: 14px;
}

.hero {
  padding: 8px 12px;
}

.hero h1 {
  margin: 2px 0 6px;
  font-family: "Bungee", "Baloo 2", cursive;
  font-size: clamp(30px, 7vw, 48px);
  line-height: 1.06;
  letter-spacing: 1px;
  color: #10212f;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.4);
}

.hero-badge {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: #0f3c5f;
  background: rgba(255, 255, 255, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  padding: 2px 12px;
}

.hero-desc {
  margin: 0;
  color: #27455e;
  font-size: 20px;
}

.card {
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: 22px;
  padding: 16px;
  box-shadow: 0 12px 0 rgba(53, 126, 173, 0.16);
}

h2,
h3 {
  margin: 0 0 8px;
  color: #15364e;
  line-height: 1.1;
}

h2 {
  font-size: clamp(24px, 5vw, 34px);
  font-family: "Bungee", "Baloo 2", cursive;
  font-weight: 400;
}

h3 {
  font-size: 24px;
  font-family: "Bungee", "Baloo 2", cursive;
  font-weight: 400;
}

h4 {
  margin: 0 0 6px;
  font-size: 20px;
  color: #2a4b63;
}

.battle-tip {
  margin: 4px 0 10px;
  color: #255274;
  font-size: 20px;
}

.lock-status {
  margin: 4px 0;
  color: #184969;
  font-size: 20px;
}

.lock-tip {
  margin: 0;
  font-size: 17px;
  color: #336280;
}

.lock-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.battle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kid-panel {
  border: 2px solid #a2cae9;
  border-radius: 16px;
  padding: 12px;
  background: linear-gradient(180deg, #fcfeff, #f3faff);
}

.kid-panel h3 {
  margin-bottom: 6px;
}

.score-board {
  display: grid;
  grid-template-columns: minmax(170px, 240px) 1fr;
  gap: 12px;
}

.score-main {
  background: linear-gradient(155deg, #fff0cb, #ffd7a3);
  border: 2px solid #ffcb7d;
  border-radius: 18px;
  padding: 12px;
}

.score-main p {
  margin: 0;
  font-weight: 700;
}

.score-main strong {
  display: block;
  font-family: "Bungee", "Baloo 2", cursive;
  font-size: clamp(34px, 8vw, 56px);
  color: #ff760f;
  line-height: 1;
}

.score-meta {
  padding: 4px 2px;
}

.score-meta p {
  margin: 0;
  font-size: 21px;
  color: #24435b;
}

.progress-wrap {
  margin-top: 12px;
  border: 2px solid #9acbed;
  border-radius: 999px;
  height: 20px;
  position: relative;
  overflow: visible;
  background: #eaf7ff;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #42c8ff, #23dd94, #ffba2c);
  transition: width 0.25s ease-out;
}

.progress-mascot {
  position: absolute;
  top: -12px;
  left: 0%;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 5px 0 rgba(33, 80, 111, 0.2);
  transform: translateX(-50%);
  transition: left 0.25s ease-out;
  display: grid;
  place-items: center;
  color: #5d3402;
  font-size: 12px;
  font-weight: 800;
}

.progress-mascot::before {
  content: "";
  position: absolute;
  top: -6px;
  width: 12px;
  height: 8px;
  border-radius: 999px 999px 0 999px;
  background: #3eaf66;
  transform: rotate(-18deg);
}

.mascot-orange {
  background: radial-gradient(circle at 30% 25%, #ffe8aa, #ffab30 65%, #f77e0f);
}

.mascot-orange::after {
  content: "橙";
}

.mascot-tangerine {
  background: radial-gradient(circle at 30% 25%, #ffe1b9, #ff9438 62%, #ff6a24);
}

.mascot-tangerine::after {
  content: "橘";
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

button {
  border: 2px solid #f2a55f;
  background: linear-gradient(180deg, #ffd79f, #ffbe5d);
  border-radius: 14px;
  color: #3b2816;
  cursor: pointer;
  font-family: "Baloo 2", "Comic Sans MS", cursive;
  font-size: 20px;
  font-weight: 700;
  padding: 7px 14px;
  transition: transform 0.16s ease, filter 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

button:active {
  transform: translateY(1px) scale(0.99);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

button.minus,
button.danger {
  background: linear-gradient(180deg, #ffd1c9, #ffafa2);
  border-color: #f48f85;
}

button.small {
  font-size: 16px;
  padding: 4px 12px;
}

.manual-form {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1.2fr minmax(100px, 160px) auto;
  gap: 8px;
  align-items: end;
}

label {
  display: grid;
  gap: 4px;
  font-size: 18px;
  color: #2c4a61;
}

input {
  width: 100%;
  border: 2px solid #9ec9e8;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 18px;
  font-family: inherit;
  color: #233b4d;
  background: #f7fcff;
}

.draw-stage {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  align-items: center;
}

.deck {
  width: 130px;
  height: 110px;
  position: relative;
}

.deck span {
  position: absolute;
  width: 80px;
  height: 108px;
  border-radius: 12px;
  border: 2px solid #4f96e0;
  background: linear-gradient(160deg, #9ce0ff, #4f99eb);
  top: 0;
  left: 50%;
  transform-origin: 50% 90%;
  box-shadow: 0 6px 0 rgba(45, 126, 191, 0.22);
  animation: deck-wiggle 2.6s ease-in-out infinite;
}

.deck span:nth-child(1) {
  transform: translateX(-70px) rotate(-16deg);
}

.deck span:nth-child(2) {
  transform: translateX(-42px) rotate(-2deg);
  animation-delay: 0.2s;
}

.deck span:nth-child(3) {
  transform: translateX(-14px) rotate(12deg);
  animation-delay: 0.4s;
}

.draw-copy p {
  margin: 0;
  font-size: 20px;
  color: #244861;
}

.reward-card-wall {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 10px;
}

.reward-card {
  position: relative;
  min-height: 124px;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  padding: 10px;
  color: #ffffff;
  overflow: hidden;
  box-shadow: 0 8px 0 rgba(33, 91, 133, 0.25);
  background: linear-gradient(160deg, var(--card-c1), var(--card-c2));
}

.reward-card::before {
  content: "";
  position: absolute;
  right: -18px;
  top: -18px;
  width: 70px;
  height: 70px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.reward-card .rarity {
  position: relative;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  font-size: 12px;
  letter-spacing: 0.03em;
  background: rgba(0, 0, 0, 0.16);
}

.reward-card .reward-name {
  position: relative;
  margin-top: 6px;
  font-size: 20px;
  line-height: 1.06;
  font-weight: 800;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
}

.reward-card .reward-prob {
  position: relative;
  margin-top: 8px;
  font-size: 15px;
  font-weight: 700;
}

.reward-card .reward-weight {
  position: relative;
  margin-top: 2px;
  font-size: 13px;
  opacity: 0.95;
}

.draw-btn {
  width: 100%;
  margin-top: 12px;
  font-size: clamp(24px, 5vw, 32px);
  font-family: "Bungee", "Baloo 2", cursive;
  color: #122437;
  border-color: #f29600;
  background: linear-gradient(180deg, #ffe270, #ffb610);
  box-shadow: 0 8px 0 rgba(250, 152, 0, 0.35);
  animation: pulse 1.9s ease-in-out infinite;
}

.draw-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  animation: none;
}

.draw-btn-child {
  font-size: clamp(20px, 4.2vw, 26px);
  animation: none;
}

.reward-tip {
  margin: 12px 0 6px;
  color: #2a4f68;
  font-size: 18px;
}

.reward-preview {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px;
}

.reward-preview li {
  padding: 6px 9px;
  border: 2px dashed #97c7e4;
  border-radius: 12px;
  background: #f8fcff;
  font-size: 18px;
}

.manager-grid,
.log-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.manager-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.manager-box {
  border: 2px solid #a2cae9;
  border-radius: 16px;
  padding: 10px;
  background: linear-gradient(180deg, #fcfeff, #f3faff);
  display: grid;
  gap: 8px;
}

.table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

th,
td {
  border-bottom: 2px dashed #b2d4ec;
  padding: 6px 8px;
  text-align: left;
  font-size: 18px;
}

th {
  color: #1a3b52;
  font-weight: 800;
}

td button + button {
  margin-left: 6px;
}

.table-input {
  padding: 4px 8px;
  font-size: 16px;
  border-radius: 10px;
}

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow: auto;
  display: grid;
  gap: 6px;
}

.log-list li {
  border: 2px solid #b5d7ee;
  border-radius: 12px;
  padding: 7px 10px;
  background: #fafdff;
  color: #27455e;
  line-height: 1.2;
  font-size: 17px;
}

.dual-log-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.child-log-card {
  border: 2px solid #a2cae9;
  border-radius: 16px;
  padding: 10px;
  background: linear-gradient(180deg, #fcfeff, #f3faff);
}

.child-score-mini {
  margin: 0 0 8px;
  color: #275170;
  font-size: 20px;
}

.reward-result-zone {
  margin-top: 10px;
  border: 2px dashed #b2d4ec;
  border-radius: 14px;
  padding: 8px;
  background: #f8fcff;
}

.reward-result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.reward-result-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 2px solid #b5d7ee;
  border-radius: 12px;
  background: #ffffff;
  padding: 6px 8px;
}

.reward-result-text {
  color: #234b66;
  font-size: 17px;
}

.redeem-btn {
  padding: 3px 10px;
  font-size: 15px;
  border-radius: 10px;
}

.redeemed-tag {
  display: inline-block;
  border: 2px solid #8fd1a2;
  color: #1f6f39;
  background: #e2f8e7;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 14px;
  font-weight: 700;
}

.password-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 120;
}

.password-modal.open {
  display: flex;
}

.password-mask {
  position: absolute;
  inset: 0;
  background: rgba(13, 34, 51, 0.6);
  backdrop-filter: blur(2px);
}

.password-panel {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  border: 3px solid #7ac6f3;
  border-radius: 18px;
  background: linear-gradient(180deg, #f6fcff, #e6f5ff);
  padding: 16px;
  box-shadow: 0 12px 0 rgba(37, 110, 156, 0.25);
}

.password-panel h2 {
  margin-bottom: 4px;
}

.password-panel p {
  margin: 0;
  color: #24506f;
}

.unlock-form {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.unlock-error {
  margin-top: 8px;
  min-height: 1.2em;
  color: #c43232;
  font-size: 16px;
}

.gacha-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 100;
}

.gacha-modal.open {
  display: flex;
}

.gacha-mask {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(20, 36, 54, 0.33), rgba(20, 36, 54, 0.72));
  backdrop-filter: blur(4px);
}

.gacha-panel {
  position: relative;
  z-index: 1;
  width: min(540px, 100%);
  background: linear-gradient(170deg, #1f6fb5, #0f5296 45%, #1f84c2);
  border: 3px solid #6ec8ff;
  border-radius: 20px;
  box-shadow: 0 14px 0 rgba(11, 46, 88, 0.46);
  padding: 18px;
  color: #ecf8ff;
  text-align: center;
}

.gacha-tag {
  margin: 0;
  font-size: 14px;
  letter-spacing: 2px;
  color: #d5f3ff;
}

.gacha-panel h2 {
  margin: 4px 0 10px;
  color: #ffffff;
  font-size: clamp(24px, 7vw, 38px);
}

.reel-wrap {
  border: 2px solid #7dd8ff;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.19);
  padding: 10px;
}

.reel-text {
  font-family: "Bungee", "Baloo 2", cursive;
  font-size: clamp(22px, 6vw, 34px);
  color: #fff08d;
  letter-spacing: 1px;
  min-height: 40px;
  animation: flicker 0.52s linear infinite;
}

.reveal-card {
  margin: 16px auto 10px;
  width: 170px;
  height: 220px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.23, 1.4, 0.4, 1);
}

.reveal-card .face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 16px;
  backface-visibility: hidden;
  border: 3px solid #ffd980;
}

.reveal-card .front {
  font-family: "Bungee", "Baloo 2", cursive;
  font-size: 86px;
  color: #ffe07a;
  background: linear-gradient(160deg, #3ea0f2, #1064b5);
}

.reveal-card .back {
  transform: rotateY(180deg);
  background: linear-gradient(170deg, #ffe78f, #ffc157);
  color: #6a3200;
  font-size: 28px;
  padding: 12px;
  line-height: 1.1;
}

.reveal-card.flipped {
  transform: rotateY(180deg);
}

.gacha-panel button {
  width: 100%;
  border-color: #ffd26d;
  background: linear-gradient(180deg, #ffe99c, #ffcb6f);
}

.empty {
  color: #5f7e94;
  font-style: italic;
}

@media (max-width: 900px) {
  .battle-grid,
  .score-board,
  .draw-stage,
  .log-grid,
  .dual-log-grid,
  .manual-form {
    grid-template-columns: 1fr;
  }

  .manual-form button {
    width: 100%;
  }

  .score-meta p,
  .draw-copy p {
    font-size: 19px;
  }
}

@media (max-width: 600px) {
  .app-shell {
    padding: 14px 8px 24px;
    gap: 10px;
  }

  .hero {
    padding: 4px 6px;
  }

  .hero-desc {
    font-size: 17px;
  }

  .card {
    padding: 12px;
    border-radius: 16px;
    box-shadow: 0 7px 0 rgba(53, 126, 173, 0.14);
  }

  h3 {
    font-size: 20px;
  }

  h4 {
    font-size: 18px;
  }

  .score-main strong {
    font-size: 40px;
  }

  .progress-mascot {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }

  .score-meta p {
    font-size: 18px;
  }

  button {
    font-size: 18px;
    padding: 7px 10px;
  }

  .quick-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .manual-form {
    margin-top: 10px;
  }

  .reward-card-wall {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .reward-card {
    min-height: 106px;
    padding: 8px;
    border-radius: 14px;
  }

  .reward-card .reward-name {
    font-size: 17px;
  }

  .reward-result-list li {
    flex-direction: column;
    align-items: flex-start;
  }

  .gacha-panel {
    border-radius: 16px;
    padding: 12px;
  }

  .reveal-card {
    width: 140px;
    height: 186px;
  }

  .reveal-card .front {
    font-size: 74px;
  }

  .reveal-card .back {
    font-size: 22px;
  }

  .unlock-form {
    grid-template-columns: 1fr;
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.02);
  }
}

@keyframes deck-wiggle {
  0%,
  100% {
    margin-top: 0;
  }

  50% {
    margin-top: -5px;
  }
}

@keyframes float-bubble {
  0% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-22px) scale(1.08);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes flicker {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.62;
  }
}
