/* base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #e5e7f0;
  color: #111827;
}

/* --- Layout --- */
.page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.card {
  width: min(92vw, 780px);
  margin: auto;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #d0d4e3;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
  padding: 20px 24px 22px;
}

/* --- Header ---*/
.card-header {
  text-align: center;
  margin-bottom: 8px;
}

.site-title {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.04em;
}

.site-tagline {
  margin: 4px 0 0;
  font-size: 12px;
  color: #6b7280;
}

/* --- Form --- */
.form-section {
  margin-top: 8px;
}

.row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.row-info {
  flex: 1.4;
  min-height: 54px;
}

.row-input {
  flex: 0.7;
  text-align: center;
}

.row-label {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.emoji {
  font-size: 14px;
}

.row-helper {
  margin: 2px 0 0;
  font-size: 11px;
  color: #6b7280;
  line-height: 1.3;
}

.score-input,
.select-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #c4c7d4;
  background: #f9fafb;
  color: #111827;
  text-align: center;
  outline: none;
}

.score-input:focus,
.select-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.4);
}

.row-error {
  margin: 2px 0 0;
  min-height: 12px;
  font-size: 11px;
  color: #b91c1c;
}

.submit-button {
  margin-top: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: none;
  background: #2563eb;
  color: #f9fafb;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.submit-button:hover {
  background: #1d4ed8;
}

/* --- Footer --- */
.site-footer {
  margin-top: 8px;
  text-align: center;
}

.footer-text {
  font-size: 11px;
  color: #6b7280;
}

/* --- Popup --- */
.popup-background {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.popup-card {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #cbd5f3;
  max-width: 360px;
  width: 90%;
  padding: 14px 14px 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.popup-medium {
  font-size: 11px;
  color: #6b7280;
}

.popup-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #111827;
}

.popup-score {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin: 4px 0 4px;
  color: #1d4ed8;
}

.popup-comment {
  font-size: 13px;
  text-align: center;
  color: #374151;
  margin-bottom: 8px;
}

.popup-breakdown {
  font-size: 12px;
  color: #4b5563;
  border-top: 1px solid #e5e7eb;
  padding-top: 6px;
  margin-top: 4px;
}

.popup-breakdown-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.popup-close {
  width: 100%;
  margin-top: 8px;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #9ca3af;
  background: #f3f4f6;
  cursor: pointer;
}

.popup-close:hover {
  background: #e5e7eb;
}

/* --- Mobile --- */
@media (max-width: 600px) {
  .card {
    padding: 14px 12px 16px;
  }

  .row {
    gap: 8px;
  }

  .row-info {
    flex: 1.6;
  }

  .row-input {
    flex: 0.8;
  }

  .site-title {
    font-size: 20px;
  }

  .site-tagline {
    font-size: 11px;
  }
}
