/* Reset & Base */
:root {
  --primary-color: #e60012;
  --secondary-color: #ffb700;
  --kohaku-red: #e60012;
  --kohaku-white: #ffffff;
  --glass-bg: rgba(0, 0, 0, 0.7);
  --glass-border: rgba(255, 255, 255, 0.2);
  --text-light: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
}

html, body {
  overflow-x: hidden;
  width: 100%;
}

body {
  background-image: url('../img/bg.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Floating Gold Particles Effect */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  background-image: 
    radial-gradient(circle, #ffb700 2px, transparent 2.5px),
    radial-gradient(circle, #ffd700 1.5px, transparent 2px),
    radial-gradient(circle, #ffeb3b 3px, transparent 3.5px);
  background-size: 100px 100px, 150px 150px, 200px 200px;
  background-position: 0 0, 50px 50px, 100px 100px;
  animation: floatParticles 20s linear infinite;
  opacity: 0.6;
}

@keyframes floatParticles {
  0% { transform: translateY(0); }
  100% { transform: translateY(-200px); }
}

/* Glassmorphism Classes */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Header */
header {
  padding: 30px 20px 20px;
  text-align: center;
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 4px 20px rgba(0,0,0,0.7);
  position: relative;
  z-index: 10;
  border-bottom: 3px solid var(--secondary-color);
}

.subtitle {
  font-size: 1.5rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  margin-bottom: 5px;
  letter-spacing: 2px;
}

header h1 {
  font-size: 3.5rem;
  font-weight: 900;
  background: linear-gradient(to bottom, #ffffff 0%, #ffd700 40%, #ff8c00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 1.5px #5c2b00;
  filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.7));
  line-height: 1.2;
  letter-spacing: 2px;
}

@media (max-width: 600px) {
  header h1 {
    font-size: 2.2rem;
    -webkit-text-stroke: 1px #5c2b00;
  }
  .subtitle {
    font-size: 1.1rem;
    letter-spacing: 1px;
  }
}

/* Main Container */
.container {
  max-width: 800px;
  margin: 40px auto;
  padding: 20px;
  flex: 1;
  width: 100%;
}

/* Input Section */
.input-section {
  padding: 30px;
  text-align: center;
  margin-bottom: 40px;
}

.input-section h2 {
  margin-bottom: 20px;
  font-size: 1.5rem;
}

.ticket-input {
  font-size: 2rem;
  padding: 10px 20px;
  width: 100%;
  max-width: 320px;
  text-align: center;
  border: 2px solid var(--secondary-color);
  border-radius: 8px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  letter-spacing: 5px;
  outline: none;
  transition: all 0.3s ease;
}

.ticket-input:focus {
  box-shadow: 0 0 15px var(--secondary-color);
}

.btn {
  display: inline-block;
  margin-top: 20px;
  padding: 15px 40px;
  font-size: 1.2rem;
  font-weight: bold;
  color: #000;
  background: linear-gradient(135deg, #ffd700, #ffb700);
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(255, 183, 0, 0.4);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 183, 0, 0.6);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  background: #555;
  color: #888;
  cursor: not-allowed;
  box-shadow: none;
}

/* Slot Machine */
.slot-wrapper {
  width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.slot-machine {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 40px auto;
  perspective: 1000px;
  padding: 50px;
  background-image: url('../img/slot_frame.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  width: max-content;
}

.reel-container {
  width: 120px;
  height: 150px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.8);
  border: 4px solid #555;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0,0,0,1), 0 10px 20px rgba(0,0,0,0.5);
}

.reel-container::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 30%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
  z-index: 2;
  pointer-events: none;
}

.reel-container::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0; height: 30%;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  z-index: 2;
  pointer-events: none;
}

.reel {
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
}

.symbol {
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.slot-img {
  width: 130px;
  height: 130px;
  object-fit: cover;
  border-radius: 12px;
  border: 3px solid #FFD700;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.cool-logo {
  object-fit: contain;
  border: none;
  border-radius: 0;
  box-shadow: none;
  mix-blend-mode: multiply;
  transform: scale(1.15);
  filter: drop-shadow(2px 4px 6px rgba(0, 0, 150, 0.5));
}

/* Result Overlay */
body.blue-screen::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 100, 0.9); /* Deep blue */
  z-index: 900;
  pointer-events: none;
  animation: fadeBlue 0.5s ease-in-out forwards;
}

@keyframes fadeBlue {
  from { opacity: 0; }
  to { opacity: 1; }
}

.overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.result-card {
  text-align: center;
  padding: 50px;
  transform: scale(0.8);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.overlay.active .result-card {
  transform: scale(1);
}

.result-card h1 {
  font-size: 4rem;
  margin-bottom: 20px;
  text-shadow: 0 0 20px var(--secondary-color);
}

.result-card p {
  font-size: 1.5rem;
  margin-bottom: 30px;
}

.close-btn {
  padding: 10px 30px;
  font-size: 1.2rem;
  background: #fff;
  color: #000;
  border: none;
  border-radius: 20px;
  cursor: pointer;
}

/* Admin Specific */
.admin-login {
  position: fixed;
  top:0; left:0; right:0; bottom:0;
  background: #0f2027; /* Fallback to a dark solid background */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.admin-login-box {
  padding: 40px;
  text-align: center;
}

.admin-login-box input {
  display: block;
  margin: 20px auto;
  padding: 10px;
  font-size: 1.2rem;
  border-radius: 5px;
  border: none;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.card {
  padding: 20px;
}

.card h3 {
  margin-bottom: 15px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 10px;
}

.stats-list {
  list-style: none;
}
.stats-list li {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 1.2rem;
}

.form-group {
  margin-bottom: 15px;
}

.form-group input {
  width: 100%;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #ccc;
  font-size: 1.1rem;
}

.message-box {
  margin-top: 15px;
  padding: 10px;
  border-radius: 5px;
  display: none;
}
.message-box.error {
  background: rgba(229, 9, 20, 0.2);
  border: 1px solid var(--primary-color);
  color: #ff6b6b;
  display: block;
}
.message-box.success {
  background: rgba(46, 204, 113, 0.2);
  border: 1px solid #2ecc71;
  color: #2ecc71;
  display: block;
}

.input-hint {
  font-size: 0.9rem;
  color: #ffb700;
  margin-top: 5px;
  min-height: 1.2em;
}

table.log-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}
table.log-table th, table.log-table td {
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding: 8px;
  text-align: left;
}

/* Responsive Improvements */
@media (max-width: 600px) {
  .container {
    margin: 15px auto;
    padding: 10px;
  }
  .input-section {
    padding: 20px 15px;
    margin-bottom: 20px;
  }
  .input-section h2 {
    font-size: 1.2rem;
  }
  .ticket-input {
    font-size: 1.6rem;
    width: 100%;
    max-width: 260px;
    padding: 8px 10px;
    letter-spacing: normal;
  }
  .btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    margin-top: 15px;
  }
  .result-card {
    padding: 35px 20px;
    width: 90%;
    max-width: 400px;
  }
  .result-card h1 {
    font-size: 2.2rem;
  }
  .result-card p {
    font-size: 1.2rem;
  }
}

/* For very narrow screens like Galaxy Z Fold cover screen */
@media (max-width: 360px) {
  .input-section {
    padding: 15px 10px;
  }
  .ticket-input {
    font-size: 1.4rem;
    padding: 8px 5px;
  }
  header h1 {
    font-size: 1.8rem;
  }
  .subtitle {
    font-size: 1rem;
}

/* Slot Machine Scaling for mobile */
@media (max-width: 520px) {
  .slot-machine {
    transform: scale(0.75);
    transform-origin: center top;
    margin: 20px auto -40px auto; /* Compenses the empty space from scaling */
  }
}

@media (max-width: 390px) {
  .slot-machine {
    transform: scale(0.62);
    transform-origin: center top;
    margin: 10px auto -60px auto;
  }
}

/* Admin Table scroll for mobile */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Rocket Animation */
.rocket {
    position: fixed;
    bottom: -150px;
    left: 50%;
    transform: translateX(-50%) rotate(0deg);
    font-size: 120px;
    z-index: 9999;
    pointer-events: none;
    filter: drop-shadow(0 0 20px rgba(255, 165, 0, 0.8));
}

.rocket.launch {
    animation: launchRocket 2.5s cubic-bezier(0.5, 0, 0.2, 1) forwards;
}

@keyframes launchRocket {
    0% {
        bottom: -150px;
        transform: translateX(-50%) rotate(0deg) scale(1);
    }
    10% {
        bottom: 0px;
        transform: translateX(-50%) rotate(-5deg) scale(1.1);
    }
    30% {
        transform: translateX(-50%) rotate(5deg) scale(1.2);
    }
    100% {
        bottom: 150vh;
        transform: translateX(-50%) rotate(0deg) scale(0.5);
    }
}

.smoke {
    position: fixed;
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, rgba(255,165,0,0.8) 0%, rgba(128,128,128,0.5) 50%, transparent 100%);
    border-radius: 50%;
    z-index: 9998;
    pointer-events: none;
    animation: smokeFade 1s ease-out forwards;
}

@keyframes smokeFade {
    0% {
        transform: scale(0.5);
        opacity: 1;
        bottom: 0;
    }
    100% {
        transform: scale(3);
        opacity: 0;
        bottom: 100px;
    }
}
