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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f4f4f9;
  color: #222;
}

#app {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 2rem;
  letter-spacing: -0.02em;
}

.subtitle {
  margin-top: 0.4rem;
  color: #555;
  font-size: 1.05rem;
}

#game {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#card {
  width: 100%;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  padding: 2.5rem 2rem;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: min-height 0.3s;
}

#card-content {
  width: 100%;
}

#question-phase {
  text-align: center;
}

#question-phase:not(.hidden) {
  animation: fadeInUp 0.3s ease-out;
}

#result-phase:not(.hidden) {
  animation: fadeInUp 0.35s ease-out;
}

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

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  60% {
    transform: scale(1.08);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

#law-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  line-height: 1.2;
}

#buttons {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 0.9rem 2.5rem;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
  min-width: 140px;
}

.btn:active {
  transform: scale(0.96);
}

.btn-left {
  background: #e53935;
  color: white;
  box-shadow: 0 4px 12px rgba(229,57,53,0.3);
}

.btn-left:hover {
  box-shadow: 0 6px 20px rgba(229,57,53,0.4);
}

.btn-right {
  background: #1565c0;
  color: white;
  box-shadow: 0 4px 12px rgba(21,101,192,0.3);
}

.btn-right:hover {
  box-shadow: 0 6px 20px rgba(21,101,192,0.4);
}

.btn-left:disabled, .btn-right:disabled {
  opacity: 0.5;
  cursor: default;
}

.hidden {
  display: none !important;
}

#result-phase {
  text-align: center;
}

#result-badge {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding: 0.6rem 1.5rem;
  border-radius: 50px;
  display: inline-block;
  animation: popIn 0.4s ease-out;
}

#result-badge.win {
  background: #e8f5e9;
  color: #2e7d32;
}

#result-badge.lose {
  background: #ffebee;
  color: #c62828;
}

#details {
  text-align: left;
  margin: 0 0 1.8rem;
  line-height: 1.6;
  font-size: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.detail-section {
  padding: 1rem 1.2rem;
  background: #f9f9fb;
  border-radius: 10px;
  border-left: 4px solid #ccc;
}

.detail-label {
  display: inline-block;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #888;
  margin-bottom: 0.3rem;
}

.detail-text {
  margin: 0;
  font-size: 0.95rem;
}

.detail-text sup a {
  color: #1565c0;
  text-decoration: none;
  font-weight: 600;
}

.detail-text sup a:hover {
  text-decoration: underline;
}

#footnotes {
  margin-top: 1.5rem;
  text-align: left;
  font-size: 0.8rem;
  color: #666;
}

#footnotes hr {
  border: none;
  border-top: 1px solid #ddd;
  margin-bottom: 0.8rem;
}

.footnotes-list {
  list-style: decimal;
  padding-left: 1.5rem;
}

.footnotes-list li {
  margin-bottom: 0.4rem;
  line-height: 1.5;
}

.footnotes-list a {
  color: #1565c0;
  word-break: break-all;
}

.footnotes-list a:hover {
  text-decoration: underline;
}

.btn-next {
  background: #333;
  color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  margin-bottom: 0.5rem;
}

.btn-next:hover {
  background: #555;
}

footer {
  text-align: center;
  margin-top: 2rem;
  color: #999;
  font-size: 0.85rem;
  font-style: italic;
}

@media (max-width: 500px) {
  #card {
    padding: 1.8rem 1.2rem;
  }

  #law-title {
    font-size: 1.6rem;
  }

  #buttons {
    flex-direction: column;
    align-items: center;
  }

  .btn {
    width: 100%;
    max-width: 220px;
  }
}
