/* ==========================================================================
   『ワンショットバケツ』 Styling - Neon Physics Puzzle Arcade
   ========================================================================== */

:root {
  --bg-deep: #060913;
  --bg-field: #0a1124;
  --bg-card: rgba(13, 21, 42, 0.94);
  --cyan: #00f2fe;
  --cyan-glow: rgba(0, 242, 254, 0.5);
  --orange: #ff7a18;
  --orange-ball: #ff9900;
  --purple-obs: #7042f4;
  --purple-light: #9d7cf7;
  --gold: #ffca28;
  --white: #ffffff;
  --gray-text: #8ea2c6;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  font-family: var(--font-stack);
  color: var(--white);
  touch-action: manipulation;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-app {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 100%;
  max-height: 880px;
  background-color: var(--bg-field);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 45px rgba(0, 0, 0, 0.8), 0 0 25px rgba(0, 242, 254, 0.15);
}

@media (min-width: 460px) and (min-height: 600px) {
  #game-app {
    height: 96vh;
    border-radius: 20px;
    border: 1px solid rgba(0, 242, 254, 0.25);
  }
}

/* Header */
.app-header {
  height: 56px;
  padding: 8px 16px;
  background: rgba(6, 10, 22, 0.85);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 242, 254, 0.15);
  z-index: 10;
}

.game-logo {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff 30%, var(--cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stage-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.5px;
}

.attempts-counter {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.attempts-counter .label {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-text);
  letter-spacing: 1px;
}

.attempts-counter .val {
  font-size: 18px;
  font-weight: 900;
  color: var(--orange);
  text-shadow: 0 0 8px rgba(255, 122, 24, 0.6);
  line-height: 1;
}

/* Main Canvas Area */
.game-main {
  flex: 1;
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #0f1938 0%, #060914 100%);
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Footer Controls */
.app-footer {
  height: 60px;
  background: rgba(6, 10, 22, 0.95);
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 10px;
  z-index: 10;
}

.control-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: var(--white);
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
}

.control-btn:hover {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
}

.control-btn:active {
  transform: scale(0.95);
}

.btn-icon {
  width: 18px;
  height: 18px;
}

.hidden {
  display: none !important;
}

/* Overlays & Modals */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 7, 18, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  padding: 20px;
  transition: opacity 0.25s ease;
}

.card-dialog {
  width: 100%;
  max-width: 360px;
  background: var(--bg-card);
  border: 1px solid rgba(0, 242, 254, 0.35);
  border-radius: 20px;
  padding: 26px 22px;
  text-align: center;
  box-shadow: 0 0 35px rgba(0, 242, 254, 0.2);
}

.card-dialog.wide {
  max-width: 400px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.badge-gwk {
  display: inline-block;
  background: rgba(0, 242, 254, 0.12);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 3px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 242, 254, 0.3);
  margin-bottom: 10px;
}

.title-main {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 1.5px;
  background: linear-gradient(135deg, #ffffff 20%, var(--orange) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}

.tagline {
  font-size: 13px;
  color: var(--cyan);
  font-style: italic;
  margin-bottom: 18px;
}

.how-to-play-box {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: left;
  border: 1px dashed rgba(0, 242, 254, 0.25);
  margin-bottom: 22px;
}

.how-to-play-box h3 {
  font-size: 14px;
  color: var(--gold);
  margin-bottom: 8px;
}

.how-to-play-box ul {
  list-style: none;
  font-size: 12.5px;
  color: #d1dcfa;
  line-height: 1.6;
}

.how-to-play-box li::before {
  content: "• ";
  color: var(--cyan);
  font-weight: bold;
}

.action-btn {
  width: 100%;
  padding: 14px 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  border: none;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--orange) 0%, #ff512f 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(255, 122, 24, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.action-btn.glow {
  animation: pulseButton 2s infinite;
}

@keyframes pulseButton {
  0% { box-shadow: 0 0 15px rgba(255, 122, 24, 0.4); }
  50% { box-shadow: 0 0 28px rgba(255, 122, 24, 0.85); }
  100% { box-shadow: 0 0 15px rgba(255, 122, 24, 0.4); }
}

.secondary-btn {
  width: 100%;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 28px;
  cursor: pointer;
}

.dialog-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Stage Select Dialog */
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.dialog-header h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--cyan);
}

.close-x {
  background: none;
  border: none;
  font-size: 26px;
  color: var(--gray-text);
  cursor: pointer;
  line-height: 1;
}

.total-stars-info {
  font-size: 13px;
  color: var(--gray-text);
  margin-bottom: 14px;
}

.gold {
  color: var(--gold);
  font-weight: 800;
}

.stages-grid-container {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  overflow-y: auto;
  padding: 4px;
  max-height: 50vh;
}

.stage-card-btn {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  color: #fff;
  transition: all 0.15s ease;
  position: relative;
}

.stage-card-btn.unlocked {
  border-color: rgba(0, 242, 254, 0.4);
  background: rgba(0, 242, 254, 0.08);
}

.stage-card-btn.current {
  border-color: var(--orange);
  box-shadow: 0 0 10px rgba(255, 122, 24, 0.5);
}

.stage-card-btn.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.stage-num-text {
  font-size: 14px;
  font-weight: 800;
}

.stage-stars-tiny {
  font-size: 8px;
  color: var(--gold);
  margin-top: 2px;
  min-height: 10px;
}

/* Clear Modal */
.celebration-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--cyan);
  text-shadow: 0 0 15px var(--cyan-glow);
  margin-bottom: 12px;
}

.stars-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.star-icon {
  font-size: 34px;
  filter: drop-shadow(0 0 8px rgba(255, 202, 40, 0.6));
}

.clear-msg {
  font-size: 15px;
  color: #cbe3ff;
  margin-bottom: 16px;
}

.stats-box {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  padding: 12px 20px;
  margin-bottom: 20px;
}

.stats-item {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--gray-text);
  margin-bottom: 6px;
}

.stats-item:last-child {
  margin-bottom: 0;
}

.stats-item strong {
  color: var(--white);
  font-size: 16px;
}

.trophy-icon {
  font-size: 54px;
  margin: 10px 0;
  filter: drop-shadow(0 0 15px rgba(255, 202, 40, 0.8));
}

.all-clear-title {
  font-size: 24px;
  font-weight: 900;
  color: var(--gold);
  margin-bottom: 6px;
}

.congrats-text {
  font-size: 13.5px;
  color: #c0d3fa;
  line-height: 1.6;
  margin-bottom: 18px;
}

.final-score-box {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 16px;
  margin-bottom: 22px;
}
