/* Premium CSS Design System - Pokémon One-Punch Calculator */

:root {
  --bg-color: #080a10;
  --panel-bg: rgba(20, 24, 38, 0.6);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-color: #f1f3f9;
  --text-muted: #8b9bb4;
  --primary-color: #00f0ff; /* Glowing cyan */
  --primary-glow: rgba(0, 240, 255, 0.4);
  --secondary-color: #bd00ff; /* Glowing violet */
  --secondary-glow: rgba(189, 0, 255, 0.4);
  --accent-color: #ff007a;
  
  /* Status Colors */
  --color-ko-sure: #00ff66; /* Green */
  --color-ko-maybe: #ffcc00; /* Yellow */
  --color-ko-no: #ff3b30; /* Red */
  
  --font-family: 'Outfit', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Background glows */
.bg-glow {
  position: fixed;
  width: 40vw;
  height: 40vw;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.15;
}

.bg-glow-1 {
  top: -10vw;
  left: -10vw;
  background: var(--primary-color);
  animation: float 20s infinite alternate;
}

.bg-glow-2 {
  bottom: -10vw;
  right: -10vw;
  background: var(--secondary-color);
  animation: float 25s infinite alternate-reverse;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5%, 10%) scale(1.1); }
  100% { transform: translate(-5%, -5%) scale(0.9); }
}

/* App Container */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  display: flex;
  justify-content: center;
  margin-bottom: 25px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 15px;
}

.tab-nav {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: 20px;
  border: 1px solid var(--panel-border);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 24px;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 16px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.tab-btn:hover {
  color: var(--text-color);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: var(--bg-color);
  background: var(--text-color);
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

/* Tabs Content Display */
.tab-content {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Title Styling */
.title-section {
  text-align: center;
  margin-bottom: 30px;
}

#main-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}

#sub-title {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Grid/Flex Layout (Vertical Stacking) */
.calc-grid {
  display: flex;
  flex-direction: column;
  gap: 25px;
  max-width: 650px;
  margin: 0 auto;
}

/* Glassmorphism Cards */
.glass-card {
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow-premium);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
}

.card-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  letter-spacing: 0.5px;
}

.attacker-theme {
  color: var(--primary-color);
  text-shadow: 0 0 10px var(--primary-glow);
}

.defender-theme {
  color: var(--secondary-color);
  text-shadow: 0 0 10px var(--secondary-glow);
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.help-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 4px;
}

/* Stat outputs */
.stat-outputs {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 12px 16px;
  margin-top: 15px;
}

.output-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

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

.output-label {
  color: var(--text-muted);
}

.output-value {
  font-weight: 600;
}

.output-value.highlight {
  color: var(--primary-color);
}

/* Firepower Index */
.firepower-index-container {
  margin-top: 20px;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.1) 0%, rgba(189, 0, 255, 0.1) 100%);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}

.firepower-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.firepower-value {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 18px 0;
}

/* Action and Status Columns */
.action-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.calc-controls-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap; /* Prevent wrapping overflow on medium screens */
  gap: 12px;
  width: 100%;
}

/* Ensure buttons and selectors flex nicely */
#calc-start-btn {
  flex: 2 1 200px;
}

.db-select-container {
  flex: 1.5 1 220px;
  min-width: 220px;
  position: relative;
}

#db-select {
  width: 100%;
  height: 100%;
  padding: 16px 38px 16px 16px; /* Right padding for custom arrow */
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px; /* match calc-btn */
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
  
  /* Remove default browser arrow style */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  
  /* Premium custom arrow */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238b9bb4' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}

#db-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
  /* Highlight custom arrow on focus */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2300f0ff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
}

/* Sound Toggle Button */
.sound-btn {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 20px;
  background-color: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 18px; /* match calc-btn and db-select */
  color: var(--text-color) !important;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.sound-btn:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
  border-color: var(--primary-color) !important;
}

/* Muted state (default) */
.sound-btn.muted {
  color: var(--text-muted) !important;
  border-color: rgba(255, 255, 255, 0.04) !important;
  background-color: rgba(0, 0, 0, 0.3) !important;
}

.sound-btn.muted:hover {
  border-color: rgba(255, 255, 255, 0.12) !important;
}

/* Active state */
.sound-btn:not(.muted) {
  border-color: var(--secondary-color) !important;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2) !important;
  color: var(--secondary-color) !important;
  background-color: rgba(0, 240, 255, 0.04) !important;
}

/* Start Button */
.calc-btn {
  width: 100%;
  padding: 16px;
  border-radius: 18px;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.calc-btn:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: #000;
  font-weight: 800;
}

.calc-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 240, 255, 0.4);
}

.calc-btn:not(:disabled):active {
  transform: translateY(1px);
}

.calc-btn:disabled {
  background: #252836;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: not-allowed;
}

.calc-btn.preparing {
  background: #252836;
  color: var(--text-muted);
  animation: pulse 1.5s infinite alternate;
}

@keyframes pulse {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* Status Cards */
.status-card {
  padding: 20px;
}

.status-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-item {
  margin-bottom: 16px;
}

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

.status-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.progress-bar-container {
  height: 8px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 4px;
  transition: width 0.1s ease;
}

.progress-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.text-highlight {
  color: var(--primary-color);
  font-weight: 600;
}

/* Stats preview inside attacker card */
.stats-preview {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.stat-badge {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stat-badge span {
  color: var(--text-color);
  font-weight: 600;
}

/* Custom Drum Picker */
.drum-picker-container {
  position: relative;
  height: 220px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}

.drum-picker-viewport {
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

.drum-picker-viewport::-webkit-scrollbar {
  display: none;
}

.drum-picker-scroll-list {
  padding: 90px 0; /* padding so top/bottom items can snap to center */
  display: flex;
  flex-direction: column;
}

.drum-item {
  height: 40px;
  line-height: 40px;
  text-align: center;
  scroll-snap-align: center;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
  color: var(--text-muted);
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 15px;
}

.drum-item.selected {
  color: #fff;
  font-weight: 700;
  transform: scale(1.08);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}

.drum-picker-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, 
    rgba(8, 10, 16, 0.95) 0%, 
    rgba(8, 10, 16, 0.4) 30%, 
    transparent 45%, 
    transparent 55%, 
    rgba(8, 10, 16, 0.4) 70%, 
    rgba(8, 10, 16, 0.95) 100%
  );
  border-top: 1px solid transparent;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

/* Draw indicator lines for selected item in drum picker */
.drum-picker-container::before {
  content: "";
  position: absolute;
  top: 90px;
  left: 10px;
  right: 10px;
  height: 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  pointer-events: none;
  border-radius: 4px;
}

.drum-picker-placeholder {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-style: italic;
}

/* Defender Stats display */
.defender-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 15px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 14px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.stat-val {
  font-weight: 600;
}

.stat-val.highlight {
  color: var(--secondary-color);
}

/* Damage Result Box */
.damage-result-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 16px;
  margin-top: 15px;
}

.damage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.damage-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
}

.result-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-normal {
  background: #3a3f58;
  color: #fff;
}

.badge-ko-sure {
  background: rgba(0, 255, 102, 0.15);
  color: var(--color-ko-sure);
  border: 1px solid rgba(0, 255, 102, 0.3);
  text-shadow: 0 0 8px rgba(0, 255, 102, 0.2);
}

.badge-ko-maybe {
  background: rgba(255, 204, 0, 0.15);
  color: var(--color-ko-maybe);
  border: 1px solid rgba(255, 204, 0, 0.3);
}

.badge-ko-no {
  background: rgba(255, 59, 48, 0.15);
  color: var(--color-ko-no);
  border: 1px solid rgba(255, 59, 48, 0.3);
}

/* Remaining HP Bar */
.hp-bar-outer {
  height: 12px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 15px;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.hp-bar-potential,
.hp-bar-guaranteed {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 6px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
}

.hp-bar-potential {
  z-index: 1;
  opacity: 0.45; /* semi-transparent for potential HP range */
}

.hp-bar-guaranteed {
  z-index: 2;
  opacity: 1.0; /* solid color for guaranteed remaining HP */
}

.hp-bar-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.25);
  pointer-events: none;
  z-index: 3;
}

/* Damage Details */
.damage-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
}

.damage-details > div {
  display: flex;
  justify-content: space-between;
}

.damage-details span:first-child {
  color: var(--text-muted);
}

.damage-details span:last-child {
  font-weight: 600;
  color: var(--text-color);
}

/* Disclaimer / card-footer */
.card-footer {
  text-align: center;
  margin-top: 15px;
}

.disclaimer-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Instruction Page (Page 2) */
.instruction-card {
  max-width: 800px;
  margin: 0 auto;
}

.instruction-content {
  color: var(--text-color);
  line-height: 1.6;
}

.instruction-content h3 {
  font-size: 1.1rem;
  margin: 20px 0 8px 0;
  color: var(--primary-color);
}

.instruction-content p {
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.instruction-content ol, 
.instruction-content ul {
  padding-left: 20px;
  margin-bottom: 15px;
  font-size: 0.92rem;
}

.instruction-content li {
  margin-bottom: 8px;
}

.about-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 25px 0;
}

.special-thanks {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.special-thanks strong {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-ko-sure { color: var(--color-ko-sure); }
.text-ko-maybe { color: var(--color-ko-maybe); }
.text-ko-no { color: var(--color-ko-no); }
.instruction-content a {
  color: var(--primary-color);
  text-decoration: underline;
  transition: var(--transition-smooth);
}

.instruction-content a:hover {
  color: var(--secondary-color);
  text-shadow: 0 0 8px var(--secondary-glow);
}

@media (max-width: 480px) {
  #main-title {
    font-size: 1.8rem;
  }
  
  .glass-card {
    padding: 18px;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .calc-controls-row {
    flex-direction: column;
    gap: 10px;
  }
  
  .db-select-container,
  .sound-btn {
    width: 100%;
  }
}
