/* ── Reset & Base ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'DM Sans', 'Hiragino Maru Gothic Pro', sans-serif;
  background: linear-gradient(160deg, #fef9ef 0%, #fde8f0 40%, #e8f0fe 70%, #eafaf1 100%);
  color: #3a3247;
  min-height: 100vh;
}

/* ── Layout ── */
.outer {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 16px;
}
.inner {
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
  padding: 24px 0;
}
.admin-wide {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 4px;
}

/* ── Header ── */
.header {
  text-align: center;
  margin-bottom: 24px;
}
.header-icon { font-size: 28px; margin-bottom: 4px; }
.header-title {
  background: linear-gradient(135deg, #e8825f, #d46ba3, #7b8de4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.header-sub {
  color: #7a7089;
  font-size: 12px;
  margin-top: 4px;
}

/* ── Buttons ── */
.role-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px;
  background: rgba(255,255,255,0.7);
  border: 2px solid #ecdff0;
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  color: #3a3247;
  box-shadow: 0 2px 8px rgba(180,160,200,0.12);
}
.role-btn:hover { background: rgba(255,255,255,0.9); border-color: #d4bce4; }
.role-btn .emoji { font-size: 26px; }
.role-btn .title { font-weight: 700; font-size: 15px; margin-bottom: 3px; color: #3a3247; }
.role-btn .desc { color: #8a7e96; font-size: 12px; }

.primary-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  color: #fff;
  margin-top: 12px;
  box-shadow: 0 3px 12px rgba(180,120,200,0.2);
}
.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.primary-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(180,120,200,0.3);
}

.ghost-btn {
  margin-top: 12px;
  background: rgba(255,255,255,0.6);
  border: 2px solid #e0d4ea;
  color: #6b5d7a;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.ghost-btn:hover { background: rgba(255,255,255,0.9); }

.s-btn {
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  color: #fff;
  border: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* ── Info Box ── */
.info-box {
  margin-top: 18px;
  background: rgba(255,255,255,0.6);
  border: 2px dashed #d9cce4;
  border-radius: 14px;
  padding: 14px;
  color: #7a6d8a;
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

/* ── Label ── */
.label {
  color: #6b5d7a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

/* ── Grid Pickers ── */
.picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.picker-btn {
  background: rgba(255,255,255,0.6);
  border: 2px solid #e8ddf0;
  border-radius: 14px;
  padding: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  color: #3a3247;
}
.picker-btn:hover { background: rgba(255,255,255,0.85); }
.picker-btn .emoji { font-size: 22px; margin-bottom: 3px; }
.picker-btn .picker-label { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.picker-btn .picker-desc { color: #8a7e96; font-size: 10px; }

/* ── MBTI ── */
.mbti-group { margin-bottom: 10px; }
.mbti-group-label {
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 5px;
  letter-spacing: 0.06em;
  font-family: 'DM Mono', monospace;
}
.mbti-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.mbti-btn {
  background: rgba(255,255,255,0.5);
  border: 2px solid #e0d4ea;
  color: #7a6d8a;
  border-radius: 10px;
  padding: 7px 0;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.mbti-btn:hover { background: rgba(255,255,255,0.8); }

/* ── Class Tabs ── */
.class-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.class-tab {
  background: rgba(255,255,255,0.5);
  border: 2px solid #e8ddf0;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 14px;
  text-align: center;
  transition: all 0.15s;
}
.class-tab:hover { background: rgba(255,255,255,0.8); }
.class-tab .cls-letter {
  font-size: 22px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
}
.class-tab .cls-count {
  font-size: 11px;
  color: #8a7e96;
}
.class-tab .badge {
  display: inline-block;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 6px;
  margin-left: 4px;
  font-family: 'DM Mono', monospace;
}

/* ── Inner Tabs ── */
.inner-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  justify-content: center;
}
.inner-tab {
  padding: 7px 14px;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  border: 2px solid #e0d4ea;
  background: rgba(255,255,255,0.4);
  color: #7a6d8a;
  transition: all 0.15s;
}
.inner-tab.active {
  background: rgba(255,255,255,0.85);
  color: #3a3247;
  border-color: #c9b5d8;
  font-weight: 600;
}

/* ── Members Panel ── */
.members-panel {
  background: rgba(255,255,255,0.55);
  border: 2px solid #e8ddf0;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(180,160,200,0.08);
}
.members-header {
  display: flex;
  align-items: center;
  font-size: 13px;
  margin-bottom: 12px;
}
.members-header .cls-label { font-weight: 600; flex: 1; color: #3a3247; }
.members-header .updated { font-size: 10px; margin-left: 6px; color: #a89bb4; }

.member-grid-header {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr 80px 1fr 40px;
  gap: 4px;
  padding: 4px 8px;
  font-size: 10px;
  color: #8a7e96;
  font-weight: 600;
  margin-bottom: 4px;
}
.member-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr 80px 1fr 40px;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 10px;
  align-items: center;
  font-size: 12px;
  transition: background 0.1s;
}
.member-row:hover { background: rgba(255,255,255,0.5); }
.member-name { color: #3a3247; font-weight: 600; }
.member-remove {
  background: #fde8e8;
  border: 1px solid #f5c4c4;
  color: #c44e4e;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.member-remove:hover { background: #f9d0d0; }

.town-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}
.town-badge {
  font-size: 11px;
  border-radius: 8px;
  padding: 4px 9px;
  font-weight: 600;
}

/* ── Team Card ── */
.team-card {
  border-radius: 18px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(180,160,200,0.1);
}
.team-card .glow {
  position: absolute;
  top: 0; right: 0;
  width: 90px; height: 90px;
  border-radius: 0 18px 0 90px;
}
.team-card-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 11px;
}
.team-badge {
  color: #fff;
  font-weight: 700;
  font-size: 10px;
  border-radius: 7px;
  padding: 3px 8px;
  font-family: 'DM Mono', monospace;
}
.team-town-label { font-size: 11px; font-weight: 600; flex: 1; }
.team-count { color: #8a7e96; font-size: 11px; }

.team-members { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.team-member {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.5);
  border: 1px solid rgba(200,180,220,0.25);
  border-radius: 10px;
  padding: 6px 8px;
}
.team-member .mbti-tag {
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 5px;
  padding: 2px 5px;
  font-family: 'DM Mono', monospace;
  min-width: 34px;
  text-align: center;
}
.team-member .name { color: #3a3247; font-size: 12px; font-weight: 600; flex: 1; }
.team-member .skill-emoji { font-size: 12px; }
.team-member .skill-label { color: #4a9e7a; font-size: 10px; font-weight: 600; }

.team-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.team-skill-tag {
  background: rgba(134,210,176,0.2);
  color: #3a8a62;
  font-size: 10px;
  border-radius: 6px;
  padding: 3px 6px;
  border: 1px solid rgba(134,210,176,0.35);
  font-weight: 600;
}

.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

/* ── Entry Submitted ── */
.submitted-card {
  text-align: center;
  padding: 16px 0;
}
.submitted-check { font-size: 44px; margin-bottom: 10px; }
.submitted-text { color: #4a9e7a; font-weight: 700; font-size: 17px; margin-bottom: 4px; }
.submitted-sub { color: #8a7e96; font-size: 13px; margin-bottom: 18px; }
.submitted-info {
  background: rgba(255,255,255,0.6);
  border: 2px solid #e0d4ea;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
}
.submitted-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
}
.submitted-row .label-text { color: #8a7e96; font-size: 12px; }
.submitted-row .value-text { color: #3a3247; font-weight: 600; font-size: 12px; }

/* ── Result Card ── */
.result-card {
  border-radius: 18px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(180,160,200,0.1);
}
.result-sub { font-size: 11px; font-weight: 700; margin-bottom: 4px; }
.result-emoji { font-size: 30px; margin-bottom: 4px; }
.result-team { font-size: 28px; font-weight: 700; font-family: 'DM Mono', monospace; }
.result-desc { color: #8a7e96; font-size: 12px; margin-top: 4px; }

/* ── Waiting ── */
.waiting {
  text-align: center;
  padding: 20px;
  color: #8a7e96;
  font-size: 13px;
}
.waiting .dots::after {
  content: '';
  animation: dots 1.5s infinite;
}
@keyframes dots {
  0% { content: ''; }
  33% { content: '.'; }
  66% { content: '..'; }
  100% { content: '...'; }
}

/* ── Empty ── */
.empty-msg {
  text-align: center;
  color: #8a7e96;
  padding: 36px 0;
  font-size: 13px;
}

/* ── Optimize Info ── */
.opt-info {
  color: #8a7e96;
  font-size: 11px;
  margin-top: 6px;
  text-align: center;
}

/* ── Select ── */
.num-select {
  background: rgba(255,255,255,0.7);
  border: 2px solid #e0d4ea;
  color: #3a3247;
  border-radius: 10px;
  padding: 8px;
  font-size: 14px;
  font-family: 'DM Mono', monospace;
}

.class-btn-group {
  display: flex;
  gap: 6px;
}
.class-select-btn {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  transition: all 0.15s;
  border: 2px solid #e0d4ea;
  background: rgba(255,255,255,0.5);
  color: #8a7e96;
}
.class-select-btn:hover { background: rgba(255,255,255,0.8); }

.entry-name-preview {
  margin-top: 10px;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  font-family: 'DM Mono', monospace;
}

.form-section {
  margin-bottom: 22px;
}
.form-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ── Actions row ── */
.actions-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

/* ── Admin teams header ── */
.teams-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.teams-header .info {
  color: #6b5d7a;
  font-size: 13px;
}

@media (max-width: 600px) {
  .member-grid-header,
  .member-row {
    grid-template-columns: 1fr 1fr 0.8fr 60px 0.8fr 36px;
    font-size: 11px;
  }
  .teams-grid {
    grid-template-columns: 1fr;
  }
}
