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

body {
  font-family: 'Garamond', 'EB Garamond', 'Cormorant Garamond', serif;
  background: #2A1F1D;
  color: #E1DCB8;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
}

.container {
  max-width: 500px;
  width: 100%;
  text-align: center;
}

h1 {
  font-size: 1.5em;
  margin-bottom: 15px;
  font-weight: normal;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

button {
  font-family: 'Garamond', 'EB Garamond', 'Cormorant Garamond', serif;
  background: #E1DCB8;
  color: #2A1F1D;
  border: 2px solid #563C27;
  padding: 12px 24px;
  font-size: 1em;
  cursor: pointer;
  margin: 5px 5px;
  transition: all 0.2s ease;
  text-transform: lowercase;
}

button.waiting-opponent {
  background: #2A1F1D;
  color: #E1DCB8;
  border-color: #563C27;
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

button:hover {
  background: #563C27;
  color: #E1DCB8;
}

button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.choice-btn {
  font-size: 3em;
  width: 80px;
  height: 80px;
  padding: 0;
  margin: 5px;
  background: #2A1F1D;
  color: #E1DCB8;
  border: 2px solid #563C27;
}

.choice-btn:hover:not(:disabled) {
  background: #E1DCB8;
  color: #2A1F1D;
}

.choice-btn.selected {
  background: #E1DCB8;
  color: #2A1F1D;
}

input {
  font-family: 'Garamond', 'EB Garamond', 'Cormorant Garamond', serif;
  background: #2A1F1D;
  border: 2px solid #563C27;
  color: #E1DCB8;
  padding: 10px;
  font-size: 1em;
  text-align: center;
  width: 150px;
  margin: 10px;
}

input:focus {
  outline: none;
  border-color: #563C27;
}

.share-link {
  border: 2px solid #563C27;
  padding: 15px;
  margin: 20px 0;
  cursor: pointer;
}

.share-link:hover {
  background: #E1DCB8;
  color: #2A1F1D;
}

.status {
  font-size: 1.2em;
  margin: 10px 0;
  min-height: 30px;
}

.result {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #2A1F1D;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 40px 20px 20px;
}

.battle-emoji {
  font-size: 5em;
  margin: 10px 0;
  opacity: 0.7;
  transition: all 0.3s ease;
}

.battle-emoji.winner {
  opacity: 1;
  text-shadow: 0 0 20px #E1DCB8;
}

.battle-label {
  font-size: 0.9em;
  opacity: 0.6;
  margin-top: -10px;
}

.battle-outcome {
  font-size: 2.5em;
  margin: 20px 0;
  font-weight: bold;
}

.battle-score {
  font-size: 1em;
  opacity: 0.7;
  margin-top: 10px;
}

.win-streak {
  font-size: 1.2em;
  margin-top: 5px;
  color: #E1DCB8;
  font-weight: bold;
}

.win-streak.active {
  animation: pulse 1s ease-in-out infinite;
}

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

.battle-combo {
  font-size: 1.5em;
  margin: 10px 0 5px 0;
  color: #E1DCB8;
  font-weight: bold;
  animation: comboAppear 0.3s ease-out;
}

@keyframes comboAppear {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

#playAgainBtn {
  position: relative;
  margin: 30px auto 20px auto;
  display: block;
  z-index: 1001;
}

.reaction-btn {
  font-size: 1.3em;
  background: none;
  border: none;
  color: #E1DCB8;
  cursor: pointer;
  padding: 0 8px;
}

.reaction-btn:hover {
  opacity: 1;
  transform: scale(1.2);
}

.reaction-separator {
  opacity: 0.3;
  margin: 0 2px;
}

.reaction-display {
  position: fixed;
  font-size: 4em;
  z-index: 2000;
  animation: reactionPop 1.5s ease-out forwards;
  pointer-events: none;
}

@keyframes reactionPop {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(0);
  }
  20% {
    opacity: 1;
    transform: scale(1.2) translateY(-20px);
  }
  100% {
    opacity: 0;
    transform: scale(1) translateY(-120px);
  }
}

.error {
  margin: 20px 0;
  padding: 15px;
  border: 2px solid #563C27;
}

.menu-section {
  margin: 30px 0;
}

.menu-section-title {
  font-size: 0.9em;
  opacity: 0.5;
  margin-bottom: 15px;
  text-transform: lowercase;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 300px;
  margin: 0 auto;
}

.menu-buttons button {
  width: 100%;
  margin: 0;
}

.menu-divider {
  width: 60px;
  height: 2px;
  background: #563C27;
  margin: 30px auto;
  opacity: 0.3;
}

.menu-input-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.menu-input-group input {
  margin: 0;
  width: 200px;
}

.menu-input-group button {
  max-width: 200px;
}

.timer {
  font-size: 2em;
  margin: 5px 0;
  font-weight: bold;
}

.timer.shake {
  animation: shake 0.8s ease-in-out infinite;
}

.timer.selected {
  opacity: 0.3;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

small {
  font-size: 0.8em;
  opacity: 0.7;
}

.debug-info {
  font-size: 0.7em;
  margin: 5px 0;
  opacity: 0.5;
}

.ai-debug-panel {
  position: fixed;
  top: 50px;
  right: 10px;
  width: 320px;
  max-height: 80vh;
  background: #2A1F1D;
  border: 2px solid #563C27;
  padding: 10px;
  font-size: 0.7em;
  overflow-y: auto;
  z-index: 1000;
  font-family: 'Courier New', monospace;
}

.ai-debug-header {
  color: #E1DCB8;
  font-weight: bold;
  margin-bottom: 10px;
  cursor: pointer;
  user-select: none;
}

.ai-debug-section {
  margin: 10px 0;
  padding: 8px;
  border: 1px solid #563C27;
}

.ai-debug-section-title {
  color: #E1DCB8;
  font-weight: bold;
  margin-bottom: 5px;
}

.ai-debug-value {
  color: #E1DCB8;
  margin-left: 10px;
  opacity: 0.7;
}

.ai-debug-highlight {
  color: #E1DCB8;
  font-weight: bold;
}

.ai-debug-probability {
  display: inline-block;
  background: #563C27;
  padding: 2px 6px;
  margin: 2px;
  border: 1px solid #E1DCB8;
}

.ai-debug-reasoning {
  margin-top: 5px;
  padding-left: 10px;
  border-left: 2px solid #563C27;
}

.ai-debug-label {
  color: #E1DCB8;
  font-weight: bold;
  margin-bottom: 5px;
}

.ai-debug-text {
  color: #E1DCB8;
  opacity: 0.8;
  line-height: 1.4;
}

.score {
  font-size: 0.9em;
  margin: 10px 0;
  cursor: pointer;
  opacity: 0.7;
}

.score:hover {
  opacity: 1;
}

.score.pending-reset, .score.reset-incoming {
  animation: blink 1s ease-in-out infinite;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.leave-btn {
  position: fixed;
  top: 10px;
  left: 10px;
  background: none;
  border: none;
  color: #563C27;
  font-size: 0.9em;
  cursor: pointer;
  padding: 5px 10px;
  z-index: 1500;
}

.leave-btn:hover {
  color: #E1DCB8;
  background: none;
}

.leave-confirm {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(42, 31, 29, 0.95);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.leave-confirm-text {
  font-size: 1.2em;
}

.leave-confirm-buttons {
  display: flex;
  gap: 15px;
}
