:root {
  --orange: #FF6600;
  --orange-dk: #E55A00;
  --orange-lt: #FFF0E6;
  --dark: #1A1A1A;
  --gray-dk: #333333;
  --gray-md: #666666;
  --gray-lt: #999999;
  --border: #E0E0E0;
  --bg: #F2F2F2;
  --white: #FFFFFF;
  --green: #22C55E;
  --green-lt: #F0FDF4;
  --red: #EF4444;
  --blue: #3B82F6;
  --blue-lt: #EFF6FF;
  --r: 12px;
  --r-sm: 8px;
  --sh: 0 1px 4px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--dark);
  font-size: 15px;
  line-height: 1.5;
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100svh;
  min-height: 100vh;
}
.screen.active { display: flex; }

.facilitator-screen {
  height: 100svh;
  height: 100vh;
  min-height: unset;
  overflow: hidden;
}

/* ===== MAIN HEADER ===== */
.main-header {
  background: var(--orange);
  padding: 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon { font-size: 26px; color: white; }
.logo-text { display: flex; flex-direction: column; gap: 1px; }
.brand { color: white; font-weight: 800; font-size: 17px; letter-spacing: 1.5px; }
.brand-sub { color: rgba(255,255,255,0.8); font-size: 11px; }
.header-badge {
  background: rgba(255,255,255,0.22);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}
.btn-header-back {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 26px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

/* ===== GROUP SELECT ===== */
.select-main {
  flex: 1;
  padding: 24px 16px 8px;
}
.select-title {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 4px;
}
.select-desc {
  color: var(--gray-md);
  font-size: 13px;
  margin-bottom: 20px;
}
.group-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.group-btn {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--r);
  padding: 20px 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--sh);
  transition: transform 0.12s;
  flex-wrap: wrap;
}
.group-btn:active { transform: scale(0.96); }
.group-btn.case-selected {
  border-color: var(--orange);
  background: var(--orange-lt);
}
.group-btn.submitted {
  border-color: var(--green);
  background: var(--green-lt);
}
.group-num { font-size: 18px; font-weight: 700; }
.group-case-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--orange);
  color: white;
}
.group-btn.submitted .group-case-badge { background: var(--green); }
.group-check { color: var(--green); font-weight: 800; font-size: 15px; }
.facilitator-entry { padding: 12px 16px 20px; text-align: center; }
.btn-facilitator-link {
  background: none;
  border: none;
  color: var(--gray-lt);
  font-size: 13px;
  cursor: pointer;
  padding: 8px 16px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ===== CASE SELECT ===== */
.case-select-main {
  flex: 1;
  padding: 24px 16px;
}
.case-select-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}
.case-option-card {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--r);
  padding: 18px 16px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--sh);
  transition: all 0.15s;
  width: 100%;
}
.case-option-card:active {
  transform: scale(0.98);
  border-color: var(--orange);
  background: var(--orange-lt);
}
.case-option-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--orange);
  background: var(--orange-lt);
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}
.case-option-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.45;
  margin-bottom: 6px;
}
.case-option-route {
  font-size: 12px;
  color: var(--gray-md);
}

/* ===== ACTIVITY HEADER ===== */
.activity-header {
  background: var(--orange);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}
.activity-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-icon-back {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 26px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}
.activity-labels {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.activity-group-name {
  color: white;
  font-weight: 700;
  font-size: 17px;
}
.activity-case-badge {
  background: rgba(255,255,255,0.25);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
}
.btn-change-case {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== ACTIVITY MAIN ===== */
.activity-main {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
}
.case-hero {
  background: var(--orange);
  border-radius: var(--r);
  padding: 16px;
  color: white;
}
.case-hero-badge {
  font-size: 11px;
  font-weight: 700;
  background: rgba(255,255,255,0.22);
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  margin-bottom: 8px;
}
.case-hero-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 10px;
}
.case-hero-route {
  font-size: 12px;
  color: rgba(255,255,255,0.82);
  background: rgba(0,0,0,0.14);
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-block;
}
.content-card {
  background: var(--white);
  border-radius: var(--r);
  padding: 16px;
  box-shadow: var(--sh);
}
.card-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}
.scenario-text {
  font-size: 14px;
  color: var(--gray-dk);
  line-height: 1.75;
}

/* ===== Q&A BLOCKS ===== */
.qa-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.qa-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.question-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.q-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--orange);
  white-space: nowrap;
  min-width: 40px;
  padding-top: 2px;
  flex-shrink: 0;
}
.q-text {
  font-size: 14px;
  color: var(--dark);
  line-height: 1.55;
  font-weight: 500;
}
.qa-textarea {
  width: 100%;
  min-height: 72px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  color: var(--dark);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  background: #FAFAFA;
}
.qa-textarea:focus { border-color: var(--orange); background: white; }
.extra-divider {
  font-size: 11px;
  font-weight: 800;
  color: var(--gray-lt);
  text-align: center;
  margin: 16px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.extra-divider::before,
.extra-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.pres-divider {
  color: var(--orange) !important;
  font-weight: 900 !important;
}
.pres-divider::before,
.pres-divider::after {
  background: var(--orange) !important;
  opacity: 0.35;
}
.submit-btn {
  display: block;
  width: 100%;
}
.submitted-banner {
  background: var(--green-lt);
  color: #16A34A;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  margin-bottom: 14px;
  border: 1px solid #BBF7D0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.submitted-banner small { font-size: 11px; color: #4ADE80; font-weight: 400; }

/* ===== COMMON BUTTONS ===== */
.btn-primary {
  background: var(--orange);
  color: white;
  border: none;
  border-radius: var(--r-sm);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
}
.btn-primary:active { background: var(--orange-dk); }
.btn-ghost {
  background: none;
  color: var(--gray-md);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost:active { background: #F5F5F5; }
.btn-danger {
  background: var(--red);
  color: white;
  border: none;
  border-radius: var(--r-sm);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.btn-danger:active { background: #DC2626; }
.btn-save {
  background: var(--dark);
  color: white;
  border: none;
  border-radius: var(--r-sm);
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
}
.btn-save:active { background: #333; }
.full-width { width: 100%; }

/* ===== FACILITATOR LOGIN ===== */
.login-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.login-card {
  background: white;
  border-radius: var(--r);
  padding: 36px 24px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.10);
  text-align: center;
}
.login-logo { font-size: 44px; display: block; color: var(--orange); margin-bottom: 12px; }
.login-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.login-card > p { color: var(--gray-md); font-size: 13px; margin-bottom: 20px; }
.pw-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px;
  font-size: 18px;
  text-align: center;
  letter-spacing: 6px;
  margin-bottom: 10px;
  outline: none;
  transition: border-color 0.15s;
}
.pw-input:focus { border-color: var(--orange); }
.pw-error { color: var(--red); font-size: 13px; margin-bottom: 10px; }
.hidden { display: none !important; }

/* ===== FACILITATOR SCREEN ===== */
.facilitator-header {
  background: var(--dark);
  color: white;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.facilitator-title { font-weight: 700; font-size: 16px; }
.btn-exit {
  background: rgba(255,255,255,0.14);
  border: none;
  color: white;
  padding: 6px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  cursor: pointer;
}
.facilitator-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.f-section {
  background: white;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.f-section-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--gray-lt);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}
.count-btn-group { display: flex; gap: 6px; }
.count-btn {
  flex: 1;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 4px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: var(--gray-md);
  transition: all 0.15s;
}
.count-btn.active { background: var(--orange); border-color: var(--orange); color: white; }
.count-display { font-size: 12px; color: var(--gray-lt); margin-top: 8px; }

/* 조별 현황 칩 */
.group-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.status-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--gray-md);
}
.status-chip.selected {
  background: var(--orange-lt);
  border-color: var(--orange);
  color: var(--orange-dk);
}
.status-chip.done {
  background: var(--green-lt);
  border-color: var(--green);
  color: #16A34A;
}
.chip-group { font-weight: 800; }
.chip-case { font-size: 11px; }
.chip-check { font-size: 12px; }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn {
  padding: 7px 16px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-md);
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn.active { background: var(--orange); border-color: var(--orange); color: white; }

.facilitator-cards {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.submission-card {
  background: white;
  border-radius: var(--r);
  padding: 14px;
  box-shadow: var(--sh);
}
.sub-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.sub-group { font-weight: 700; font-size: 15px; }
.sub-case {
  font-size: 11px;
  font-weight: 700;
  background: var(--orange-lt);
  color: var(--orange);
  padding: 2px 8px;
  border-radius: 20px;
}
.sub-time { font-size: 12px; color: var(--gray-lt); margin-left: auto; }
.sub-qa-list { display: flex; flex-direction: column; gap: 10px; }
.sub-qa-item { display: flex; gap: 8px; align-items: flex-start; }
.sub-q-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--orange);
  white-space: nowrap;
  min-width: 38px;
  padding-top: 2px;
  flex-shrink: 0;
}
.sub-q-answer { font-size: 13px; color: var(--gray-dk); line-height: 1.6; }
.sub-empty { font-size: 13px; color: var(--gray-lt); }
.empty-msg { text-align: center; color: var(--gray-lt); padding: 48px 0; font-size: 14px; }

/* ===== CASE SECTION (facilitator) ===== */
.case-section {
  background: white;
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--sh);
}
.case-section-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 12px;
  background: var(--orange);
  cursor: pointer;
  user-select: none;
}
.case-section-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.case-section-badge {
  font-size: 11px;
  font-weight: 800;
  background: rgba(255,255,255,0.25);
  color: white;
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-block;
  width: fit-content;
  letter-spacing: 0.5px;
}
.case-section-title {
  font-size: 14px;
  font-weight: 700;
  color: white;
  line-height: 1.4;
}
.case-section-route {
  font-size: 11px;
  color: rgba(255,255,255,0.78);
}
.case-section-chevron {
  color: white;
  font-size: 18px;
  flex-shrink: 0;
  transition: transform 0.2s;
  margin-top: 2px;
}
.case-section.collapsed .case-section-chevron { transform: rotate(-90deg); }
.case-section.collapsed .case-section-body { display: none; }

.case-section-body { border-top: none; }

.f-block {
  padding: 14px;
  border-bottom: 1px solid #F0F0F0;
}
.f-block:last-child { border-bottom: none; }
.f-block-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--gray-lt);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}
.f-subs-label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.f-sub-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--orange-lt);
  color: var(--orange);
  padding: 1px 7px;
  border-radius: 20px;
  text-transform: none;
  letter-spacing: 0;
}
.f-scenario-text {
  font-size: 13px;
  color: var(--gray-dk);
  line-height: 1.75;
}
.f-q-list { display: flex; flex-direction: column; }
.f-q-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 7px 0;
  border-bottom: 1px solid #F5F5F5;
}
.f-q-item:last-child { border-bottom: none; }
.f-q-item .q-text { font-size: 13px; }
.f-subs-block .submission-card {
  box-shadow: none;
  border: 1.5px solid var(--border);
  margin-bottom: 8px;
}
.f-subs-block .submission-card:last-child { margin-bottom: 0; }
.empty-sub-msg { font-size: 13px; color: var(--gray-lt); text-align: center; padding: 16px 0; }

.facilitator-bottom {
  background: white;
  border-top: 1px solid var(--border);
  padding: 12px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.refresh-text { font-size: 12px; color: var(--gray-lt); text-align: center; }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: -56px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: white;
  padding: 11px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  transition: bottom 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9999;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show { bottom: 28px; }

/* ===== SHAKE ===== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  60% { transform: translateX(5px); }
  80% { transform: translateX(-3px); }
}
.shake { animation: shake 0.45s ease; }

/* ===== DESKTOP ===== */
@media (min-width: 520px) {
  body {
    display: flex;
    justify-content: center;
    background: #DCDCDC;
  }
  .screen {
    max-width: 480px;
    width: 100%;
    box-shadow: 0 0 40px rgba(0,0,0,0.18);
    background: var(--bg);
  }
}
