:root {
  --bg-start: #fff1f7;
  --bg-mid: #ffe5f1;
  --bg-end: #fff8fb;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-soft: rgba(255, 249, 254, 0.68);
  --surface-border: rgba(236, 72, 153, 0.22);
  --text-main: #2a2341;
  --text-soft: #6c617f;
  --accent: #ec4899;
  --accent-dark: #db2777;
  --accent-soft: rgba(236, 72, 153, 0.16);
  --accent-2: #f9a8d4;
  --danger: #f43f5e;
  --shadow-soft: rgba(190, 24, 93, 0.16);
  --shadow-deep: rgba(190, 24, 93, 0.24);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Poppins', 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Segoe UI', sans-serif;
  min-height: 100vh;
  color: var(--text-main);
  background: radial-gradient(circle at 20% 0%, #ffe9f5 0%, transparent 38%),
    linear-gradient(150deg, var(--bg-start), var(--bg-mid) 55%, var(--bg-end));
}

body::before {
  content: '';
  position: fixed;
  inset: -10vh;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at center, rgba(236, 72, 153, 0.35), rgba(236, 72, 153, 0) 58%);
  mix-blend-mode: screen;
}

body.match-flash::before {
  animation: match-screen-flash 1.2s ease;
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 18px;
  backdrop-filter: blur(12px);
  padding: 18px;
  box-shadow: 0 18px 38px var(--shadow-soft);
}

h1, h2, h3 {
  margin-top: 0;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(255, 245, 252, 0.97), rgba(255, 233, 247, 0.9));
  border-bottom: 1px solid var(--surface-border);
}

.app-title {
  margin: 0 auto;
  max-width: 980px;
  padding: 14px 16px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.error-banner {
  margin: 10px auto 0;
  max-width: 980px;
  color: #7f1d5a;
  background: rgba(253, 242, 248, 0.95);
  border: 1px solid rgba(236, 72, 153, 0.45);
  border-radius: 12px;
  padding: 10px 12px;
  display: none;
}

.error-banner.show {
  display: block;
}

.hidden {
  display: none;
}

form label {
  display: block;
  margin-bottom: 10px;
}

form input,
button,
.badge,
code,
textarea {
  font: inherit;
}

input,
textarea,
select,
button {
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  color: var(--text-main);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(236, 72, 153, 0.62);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.18);
}

button {
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, opacity 0.15s ease;
  font-weight: 600;
}

button:hover { transform: translateY(-1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.primary {
  background: linear-gradient(135deg, var(--accent), #db2777);
  color: #fff;
}

.secondary {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.22), rgba(249, 168, 212, 0.22));
  color: #5c2c5f;
}

.danger {
  background: linear-gradient(135deg, #fb7185, #f43f5e);
  color: #fff;
}

.tabbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 20px 0;
  gap: 6px;
}

.tabbar button {
  padding: 12px;
  border-radius: 12px;
}

.tabbar button.active {
  background: linear-gradient(140deg, var(--accent), #ec4899);
  color: #fff;
  box-shadow: 0 8px 22px rgba(219, 39, 119, 0.24);
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

.profile-card {
  min-height: 280px;
  position: relative;
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(160deg, rgba(255, 236, 246, 0.96), rgba(255, 246, 252, 0.9));
  border: 1px solid var(--surface-border);
}

.profile-card .badge {
  position: absolute;
  right: 12px;
  top: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #7f1d5a;
  background: rgba(236, 72, 153, 0.16);
  letter-spacing: 0.03em;
}

.profile-answer {
  margin: 10px 0;
  padding: 12px;
  background: rgba(255, 240, 248, 0.74);
  border-radius: 12px;
}

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

.actions button {
  padding: 12px;
  border-radius: 12px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--surface-border);
}

.list-item > div {
  overflow: hidden;
}

#question-container {
  display: grid;
  gap: 14px;
}

.question-field {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(253, 244, 252, 0.85);
  border: 1px solid rgba(236, 72, 153, 0.22);
}

.question-field__label {
  color: #7a4f7f;
  font-weight: 600;
  font-size: 0.94rem;
}

.question-input {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(236, 72, 153, 0.3);
  padding: 11px 12px;
}

.question-input::placeholder {
  color: #a97fa4;
}

#question-editor input {
  width: 100%;
  background: #fff;
  border-radius: 10px;
  border: 1px solid rgba(236, 72, 153, 0.3);
}

#question-editor .list-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

#question-editor .list-item > input {
  flex: 1;
}

.row-actions {
  display: inline-flex;
  gap: 6px;
}

.list-item small {
  color: var(--text-soft);
}

.notice-badge {
  min-width: 24px;
  text-align: center;
  border-radius: 999px;
  padding: 4px 8px;
  color: #fff;
  background: linear-gradient(130deg, #f43f5e, #ec4899);
  font-weight: 700;
}

.match-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 12px;
}

.chat-box {
  min-height: 260px;
  border-radius: 12px;
  border: 1px dashed rgba(236, 72, 153, 0.34);
  padding: 10px;
  background: rgba(255, 244, 251, 0.72);
}

.chat-message {
  margin: 10px 0;
  padding: 8px 10px;
  border-radius: 12px;
  width: fit-content;
  max-width: 92%;
}

.chat-message.me {
  margin-left: auto;
  background: rgba(244, 114, 182, 0.22);
}

.chat-message.other {
  background: rgba(233, 213, 255, 0.42);
}

.replies {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.replies button {
  text-align: left;
  border-radius: 10px;
  padding: 10px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid rgba(236, 72, 153, 0.16);
  vertical-align: top;
}

.table th { color: #6e597f; }

.pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(236, 72, 153, 0.22);
  font-size: 12px;
}

.small {
  color: var(--text-soft);
  font-size: 12px;
}

@media (max-width: 860px) {
  .match-layout {
    grid-template-columns: 1fr;
  }

  .actions {
    grid-template-columns: 1fr;
  }
}

.match-modal.hidden {
  display: none;
}

.match-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
}

.match-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(59, 46, 67, 0.62);
  backdrop-filter: blur(3px);
}

.match-modal__panel {
  position: relative;
  z-index: 31;
  width: min(440px, 100%);
  border-radius: 18px;
  padding: 22px;
  background: linear-gradient(155deg, rgba(255, 244, 252, 0.98), rgba(252, 231, 243, 0.88));
  border: 1px solid rgba(236, 72, 153, 0.28);
  box-shadow: 0 20px 65px var(--shadow-deep);
  animation: match-pop 0.25s ease;
}

.match-modal__glow {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: radial-gradient(circle at top, rgba(236, 72, 153, 0.24), transparent 52%);
  pointer-events: none;
}

.match-modal h2 {
  margin: 0 0 10px;
}

.match-modal__profile {
  margin: 14px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.match-profile-card {
  padding: 8px 10px;
  border: 1px dashed rgba(236, 72, 153, 0.24);
  border-radius: 10px;
  background: rgba(254, 247, 253, 0.82);
}

.match-modal__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.match-modal__actions button {
  padding: 11px;
}

.match-confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  overflow: hidden;
}

.match-confetti-piece {
  --tx: 0px;
  --ty: 320px;
  --r: 360deg;
  --delay: 0s;
  --duration: 1.2s;
  position: absolute;
  transform-origin: center;
  animation: match-confetti var(--duration) cubic-bezier(0.2, 0.85, 0.25, 1) var(--delay) forwards;
}

@keyframes match-confetti {
  from {
    opacity: 1;
    transform: translate(-50%, 0) rotate(0deg) scale(1);
  }

  to {
    opacity: 0;
    transform: translate(calc(-50% + var(--tx)), var(--ty)) rotate(var(--r)) scale(0.8);
  }
}

@keyframes match-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes match-screen-flash {
  0% {
    opacity: 0;
  }

  12% {
    opacity: 0.95;
  }

  18%,
  100% {
    opacity: 0;
  }
}
