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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e0e0e0;
}

.container {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2.5rem 3rem;
  width: min(480px, 92vw);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  text-align: center;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #e94560;
  margin-bottom: 1rem;
  letter-spacing: 1px;
}

.subtitle {
  color: #a0a8c0;
  margin-bottom: 1.8rem;
  font-size: 1rem;
}

/* Mode Toggle */
.mode-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: rgba(0,0,0,0.2);
  border-radius: 14px;
  padding: 4px;
}

.mode-btn {
  flex: 1;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  background: transparent;
  color: #8090b0;
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.1s;
}

.mode-btn:hover {
  color: #c0cce0;
  transform: none;
  box-shadow: none;
}

.mode-btn.active {
  background: linear-gradient(135deg, #e94560, #c73652);
  color: #fff;
  box-shadow: 0 3px 10px rgba(233, 69, 96, 0.4);
}

/* Form */
.form-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
}

.form-group label {
  font-size: 1rem;
  color: #c0c8e0;
  min-width: 120px;
  text-align: right;
}

input[type="number"] {
  flex: 1;
  min-width: 0;
  max-width: 120px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  padding: 0.6rem 0.9rem;
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  direction: ltr;
}

input[type="number"]:focus {
  border-color: #e94560;
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.2);
}

/* Buttons */
button {
  cursor: pointer;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.75rem 2rem;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233, 69, 96, 0.35);
}

button:active {
  transform: translateY(0);
}

#start-btn {
  margin-top: 1rem;
  background: linear-gradient(135deg, #e94560, #c73652);
  color: #fff;
  width: 100%;
}

#guess-btn {
  background: linear-gradient(135deg, #0f3460, #1a5276);
  color: #fff;
  padding: 0.65rem 1.5rem;
  border: 1px solid rgba(255,255,255,0.15);
}

#end-phase button {
  margin-top: 1.5rem;
  background: linear-gradient(135deg, #e94560, #c73652);
  color: #fff;
}

/* Info bar */
.info-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.info-bar span {
  background: rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
  color: #b0bcd8;
  flex: 1;
  min-width: 120px;
}

/* Guess area (user mode) */
.guess-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.guess-area label {
  color: #c0c8e0;
  font-size: 0.95rem;
  min-width: fit-content;
}

.guess-area input {
  flex: 1;
  min-width: 80px;
}

/* Feedback (user mode) */
.feedback {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0.8rem 0;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  transition: all 0.3s;
}

.feedback.bigger {
  background: rgba(52, 152, 219, 0.15);
  color: #5dade2;
  border: 1px solid rgba(93, 173, 226, 0.3);
}

.feedback.smaller {
  background: rgba(231, 76, 60, 0.15);
  color: #ec7063;
  border: 1px solid rgba(236, 112, 99, 0.3);
}

/* Chosen button */
#chosen-btn {
  margin-top: 0.8rem;
  background: linear-gradient(135deg, #27ae60, #1e8449);
  color: #fff;
  width: 100%;
}

#chosen-btn:hover {
  box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

/* Computer guess box */
.think-label {
  color: #a0a8c0;
  font-size: 0.95rem;
  margin-bottom: 1.2rem;
}

.computer-guess-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 1.2rem;
}

.guess-label {
  font-size: 0.9rem;
  color: #8090b0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#computer-guess-number {
  font-size: 3.5rem;
  font-weight: 800;
  color: #f7dc6f;
  line-height: 1;
  text-shadow: 0 0 20px rgba(247, 220, 111, 0.4);
  transition: transform 0.2s;
}

.feedback-prompt {
  color: #a0a8c0;
  font-size: 0.95rem;
  margin-bottom: 0.8rem;
}

/* Response buttons */
.response-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.resp-row {
  display: flex;
  gap: 0.6rem;
}

.resp-btn {
  padding: 0.65rem 1.1rem;
  font-size: 0.95rem;
  border-radius: 12px;
  font-weight: 600;
  flex: 1;
}

.resp-exact {
  width: 100%;
}

.resp-smaller {
  background: rgba(231, 76, 60, 0.15);
  color: #ec7063;
  border: 1px solid rgba(236, 112, 99, 0.3);
}

.resp-smaller:hover {
  background: rgba(231, 76, 60, 0.3);
  box-shadow: 0 4px 14px rgba(231,76,60,0.3);
}

.resp-correct {
  background: rgba(88, 214, 141, 0.15);
  color: #58d68d;
  border: 1px solid rgba(88, 214, 141, 0.3);
}

.resp-correct:hover {
  background: rgba(88, 214, 141, 0.3);
  box-shadow: 0 4px 14px rgba(88,214,141,0.3);
}

.resp-bigger {
  background: rgba(52, 152, 219, 0.15);
  color: #5dade2;
  border: 1px solid rgba(93, 173, 226, 0.3);
}

.resp-bigger:hover {
  background: rgba(52, 152, 219, 0.3);
  box-shadow: 0 4px 14px rgba(52,152,219,0.3);
}

/* History */
.history {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.history-item {
  font-size: 0.8rem;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  color: #8090b0;
  transition: background 0.2s, color 0.2s;
}

.c-hist-bigger {
  background: rgba(52, 152, 219, 0.12);
  color: #5dade2;
}

.c-hist-smaller {
  background: rgba(231, 76, 60, 0.12);
  color: #ec7063;
}

.conflict {
  background: rgba(255, 200, 0, 0.25) !important;
  color: #f7dc6f !important;
  border: 1px solid rgba(247, 220, 111, 0.6);
  font-weight: 700;
}

/* Contradiction box */
.contradiction-box {
  margin-top: 1rem;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: 12px;
  padding: 1rem 1.2rem;
}

.contradiction-box p {
  color: #ec7063;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 0.8rem;
}

.contradiction-box strong {
  color: #f7dc6f;
  font-size: 1.1rem;
}

.contradiction-box button {
  background: linear-gradient(135deg, #e94560, #c73652);
  color: #fff;
  padding: 0.55rem 1.5rem;
  font-size: 0.95rem;
}

/* End phase */
#end-message {
  font-size: 1.4rem;
  font-weight: 700;
  color: #58d68d;
  line-height: 1.6;
}

#end-message .number-reveal {
  font-size: 2.5rem;
  color: #f7dc6f;
  display: block;
  margin: 0.4rem 0;
}

/* K preview */
.k-preview {
  margin: 0.6rem 0 0.2rem;
  font-size: 0.95rem;
  color: #58d68d;
  background: rgba(88, 214, 141, 0.08);
  border: 1px solid rgba(88, 214, 141, 0.2);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
}

/* Error */
.error {
  color: #e74c3c;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* Utility */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 400px) {
  .container {
    padding: 1.8rem 1.5rem;
  }
  h1 {
    font-size: 1.6rem;
  }
  .resp-btn {
    min-width: 80px;
    padding: 0.55rem 0.7rem;
    font-size: 0.85rem;
  }
}
