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

html, body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #050714;
  color: #f6f7ff;
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: 100vh;
}

.mg-app {
  width: 100%;
  max-width: 720px;
  min-height: 100vh;
  background: radial-gradient(circle at top, #202858 0, #050714 55%);
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
}

.mg-header {
  padding: 4px 4px 12px;
}

.mg-header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.mg-header-sub {
  margin-top: 4px;
}

.mg-header-subtext {
  font-size: 14px;
  color: #a8b2ff;
}

.mg-main {
  flex: 1;
  overflow-y: auto;
  padding-top: 4px;
}

.mg-screen {
  display: none;
  animation: fadeIn 0.15s ease-out;
}

.mg-screen-active {
  display: block;
}

.mg-section {
  margin-bottom: 18px;
}

.mg-section-title {
  font-size: 18px;
  margin: 0 0 8px;
}

.mg-subsection-title {
  font-size: 16px;
  margin: 0 0 6px;
  color: #d0d4ff;
}

.mg-card {
  background: rgba(6, 10, 32, 0.9);
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(108, 122, 255, 0.18);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.mg-disabled-card {
  opacity: 0.6;
}

.mg-primary-btn,
.mg-secondary-btn,
.mg-outline-btn,
.mg-mini-btn,
.mg-back-btn,
.mg-chip,
.mg-l1-btn {
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.mg-primary-btn {
  background: linear-gradient(135deg, #5565ff, #9b6bff);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
}

.mg-secondary-btn {
  background: rgba(18, 24, 68, 0.95);
  color: #f6f7ff;
  border: 1px solid rgba(111, 119, 255, 0.7);
}

.mg-outline-btn {
  background: transparent;
  color: #d4d7ff;
  border: 1px solid rgba(156, 162, 255, 0.6);
}

.mg-mini-btn {
  font-size: 12px;
  padding: 4px 10px;
  background: rgba(28, 36, 96, 0.95);
  color: #dfe3ff;
  border: 1px solid rgba(138, 150, 255, 0.8);
}

.mg-back-btn {
  background: transparent;
  color: #e1e3ff;
  border: 1px solid rgba(116, 135, 255, 0.6);
  padding-inline: 10px;
}

.mg-full-width {
  width: 100%;
}

.mg-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.mg-actions-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.mg-list-item {
  padding: 6px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid rgba(94, 104, 196, 0.3);
}

.mg-list-item:last-child {
  border-bottom: none;
}

.mg-list-item-btn {
  background: transparent;
  border: none;
  color: inherit;
  text-align: left;
}

.mg-list-title {
  font-size: 14px;
}

.mg-list-sub {
  font-size: 12px;
  color: #a5a9f0;
}

.mg-list-meta {
  font-size: 11px;
  color: #c7cbff;
  text-align: right;
}

.mg-chip {
  background: rgba(18, 24, 68, 0.9);
  color: #d3d6ff;
  border: 1px solid rgba(135, 147, 255, 0.7);
  font-size: 12px;
  padding-inline: 10px;
}

.mg-chip-active {
  background: linear-gradient(135deg, #5867ff, #a970ff);
  color: #fff;
}

.mg-chip-ghost {
  background: rgba(37, 45, 110, 0.95);
  border-color: rgba(172, 181, 255, 0.6);
}

.mg-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mg-header-subtext,
.mg-muted,
.mg-caption {
  font-size: 12px;
  color: #9aa0e3;
}

.mg-caption {
  margin-top: 6px;
}

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

.mg-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mg-label {
  font-size: 13px;
  color: #d7dbff;
}

input[type="text"],
textarea {
  background: rgba(7, 10, 38, 0.95);
  border-radius: 10px;
  border: 1px solid rgba(110, 123, 255, 0.7);
  color: #f6f7ff;
  padding: 8px 10px;
  font-size: 14px;
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  box-shadow: 0 0 0 1px rgba(157, 169, 255, 0.8);
}

textarea {
  resize: vertical;
  min-height: 40px;
}

.mg-form-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.mg-icon-btn {
  border-radius: 999px;
  border: none;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #b2b8ff;
}

.mg-icon-btn-disabled {
  opacity: 0.5;
  cursor: default;
}

/* Today card */
.mg-today-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mg-today-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.mg-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(24, 30, 86, 0.9);
  overflow: hidden;
}

.mg-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4c8dff, #76e0ff);
}

.mg-bar-fill-physical {
  background: linear-gradient(90deg, #ffaf4c, #ffd976);
}

.mg-oneword {
  margin: 4px 0 0;
  font-size: 13px;
}

.mg-foreshadow {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(126, 138, 255, 0.5);
}

.mg-foreshadow-title {
  font-size: 12px;
  color: #9fa7ff;
}

.mg-foreshadow-text {
  font-size: 13px;
  margin: 2px 0 0;
}

/* Screen header */
.mg-screen-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.mg-screen-title {
  font-size: 18px;
  margin: 0;
}

/* People detail */
.mg-basic-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mg-basic-name {
  font-size: 16px;
}

.mg-basic-category {
  font-size: 12px;
  color: #a3a9ff;
}

.mg-intro-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(87, 96, 196, 0.5);
}

.mg-intro-item:last-child {
  border-bottom: none;
}

.mg-intro-q {
  font-size: 12px;
  color: #a5abff;
}

.mg-intro-a {
  font-size: 13px;
}

.mg-type-block + .mg-type-block {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(90, 99, 201, 0.6);
}

.mg-type-heading {
  font-size: 13px;
  margin-bottom: 4px;
  color: #cbd0ff;
}

.mg-type-main {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.mg-type-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.mg-type-list li {
  font-size: 13px;
}

.mg-match-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mg-match-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.mg-match-stars {
  font-size: 18px;
}

.mg-match-comment {
  font-size: 13px;
}

.mg-gap-chip {
  align-self: flex-start;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(40, 53, 122, 0.9);
  border: 1px solid rgba(167, 175, 255, 0.7);
}

.mg-gap-comment {
  font-size: 12px;
  color: #b9befb;
}

.mg-unlock-block {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
}

.mg-unlock-main {
  flex: 1;
}

.mg-unlock-title {
  font-size: 13px;
  margin-bottom: 2px;
}

.mg-unlock-content {
  font-size: 12px;
}

.mg-divider {
  border-top: 1px dashed rgba(110, 120, 204, 0.6);
  margin: 4px 0;
}

/* L1 */
.mg-l1-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mg-l1-row {
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(11, 17, 54, 0.9);
}

.mg-l1-label {
  font-size: 12px;
  margin-bottom: 4px;
  color: #cbd1ff;
}

.mg-l1-scale {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mg-l1-end {
  font-size: 10px;
  color: #9ea5f2;
  width: 64px;
}

.mg-l1-buttons {
  flex: 1;
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.mg-l1-btn {
  flex: 1;
  font-size: 11px;
  padding-inline: 4px;
  background: rgba(18, 24, 68, 0.9);
  border: 1px solid rgba(110, 121, 215, 0.7);
  color: #d6dbff;
}

.mg-l1-btn-active {
  background: linear-gradient(135deg, #5d6eff, #a36cff);
  border-color: transparent;
  color: #fff;
}

/* 質問票 */

.mg-step-indicator {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 13px;
  color: #c4c9ff;
}

.mg-step-bar {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(108, 122, 255, 0.25);
  overflow: hidden;
}

.mg-step-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6c7aff, #c671ff);
  transition: width 0.2s ease-out;
}

.mg-step-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.mg-step-final-note {
  font-size: 13px;
  color: #a8b2ff;
}
.mg-questionnaire {
  margin-bottom: 8px;
}

.mg-question {
  padding: 8px 6px;
  border-radius: 8px;
  border: 1px solid rgba(86, 95, 191, 0.5);
  background: rgba(14, 18, 54, 0.95);
  margin-bottom: 8px;
}

.mg-question-title {
  font-size: 15px;
  margin-bottom: 4px;
}

.mg-question-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mg-radio-label {
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.mg-radio-label input {
  margin-top: 3px;
}

.mg-diagnose-result {
  margin-top: 8px;
}

/* モーダル */
.mg-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.mg-modal-open {
  display: flex;
}

.mg-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}

.mg-modal-body {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: radial-gradient(circle at top, #252b66 0, #06081f 60%);
  border-radius: 18px;
  padding: 14px 16px 16px;
  border: 1px solid rgba(115, 129, 255, 0.8);
  box-shadow: 0 16px 40px rgba(0,0,0,0.8);
}

.mg-modal-title {
  margin: 0 0 8px;
  font-size: 16px;
}

.mg-range-value {
  text-align: right;
  font-size: 12px;
  color: #c3c9ff;
}

/* Back icon row */
.mg-back-btn {
  font-size: 13px;
}

/* Utilities */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 768px) {
  .mg-app {
    border-radius: 24px;
    margin: 12px;
  }
}
