* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

/* 2026-03-07: phase-based flow and two-round controls */
.app__phases {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.1rem;
}

.phase-nav__item {
  min-height: 36px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1.2;
  color: #0f172a;
  font-weight: 700;
  background: #ffffff;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phase-nav__item.is-active {
  color: #ffffff;
  border-color: #0f766e;
  background: #0f766e;
}

.app__section {
  display: grid;
  gap: 0.65rem;
}

.app[data-phase="4"] .app__section--additional {
  order: 1;
}

.app[data-phase="4"] .app__section--participants {
  order: 2;
}

.app__inline-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mini-guide {
  margin: 0;
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.35;
  color: #0f766e;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: #f7fbfa;
}

.controls .app__phase-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.controls .app__ghost-button,
.controls .app__shuffle-button {
  width: 100%;
  justify-self: stretch;
  min-height: 44px;
  border-radius: 10px;
  padding: 0.4rem 0.85rem;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
}

.controls .app__ghost-button {
  border: 1px solid rgba(15, 118, 110, 0.3);
  background: #ffffff;
  color: #0f172a;
}

.controls .app__ghost-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.controls .app__ghost-button--primary {
  border-color: #0f766e;
  color: #ffffff;
  background: #0f766e;
}

.controls .app__ghost-button--primary:disabled {
  opacity: 1;
  color: #e2e8f0;
  border-color: #94a3b8;
  background: #94a3b8;
  cursor: not-allowed;
}

.controls .app__shuffle-button {
  border: none;
  color: #ffffff;
  background: #0f766e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.controls .app__shuffle-button:disabled {
  opacity: 1;
  color: #e2e8f0;
  background: #94a3b8;
  cursor: default;
}

.app__phase1-next {
  margin-top: 0.5rem;
  padding: 0 0.9rem;
}

.controls > .app__ghost-button,
.controls > .app__shuffle-button {
  width: calc(100% - 1.8rem);
  justify-self: center;
}

.input-sheet.input-sheet--participant col.col-name {
  width: 34%;
}

.input-sheet--facilitator {
  min-width: 420px;
  table-layout: fixed;
}

.input-sheet--facilitator td {
  text-align: left;
  width: 25%;
}

.input-sheet.input-sheet--participant col.col-role {
  width: 33%;
}

.app[data-phase="4"] .app__input-sheet--participant .participant-col-round1,
.app[data-phase="4"] .app__input-sheet--participant .participant-header-round1,
.app[data-phase="4"] .app__input-sheet--participant .participant-cell-round1 {
  display: none;
}

.app[data-phase="4"] .app__input-sheet--participant .participant-col-round1 {
  width: 0;
}

.app[data-phase="4"] .app__input-sheet--participant .app__input-col--name,
.input-sheet.input-sheet--additional col.col-name {
  width: 64%;
}

.app[data-phase="4"] .app__input-sheet--participant .participant-col-round2,
.input-sheet.input-sheet--additional col.col-role {
  width: 36%;
}

.input-sheet td:nth-child(4) {
  text-align: center;
}

.result-groups-layout {
  display: grid;
  width: 100%;
  gap: 0.9rem;
}

.result-groups-note {
  margin: 0;
  padding: 0;
  font-size: 0.84rem;
  line-height: 1.4;
  color: #0f766e;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 840px) {
  .app__phases {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .phase-nav__item {
    font-size: 0.78rem;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  color: #1f2937;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic",
    sans-serif;
}

html {
  scrollbar-gutter: stable;
}

.app {
  width: min(1640px, 98vw);
  margin: 0.85rem auto 1.4rem;
  padding: 0.9rem 0.95rem 0.95rem;
  background: #ffffff;
  border: none;
  border-radius: 18px;
  backdrop-filter: blur(2px);
}

.app-header {
  margin-bottom: 0.95rem;
}

.app-header h1 {
  margin: 0 0 0.3rem;
  font-size: 1.95rem;
}

.app-header p {
  margin: 0;
  color: #6b7280;
  font-size: 0.94rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
  gap: 1rem;
  margin-top: 3rem;
  align-items: start;
}

.workspace > * {
  min-width: 0;
}

.app.is-drawing .workspace {
  display: none !important;
}

.controls {
  position: static;
  top: auto;
  align-self: start;
  display: grid;
  gap: 0.8rem;
  min-width: 0;
}

.control-card {
  padding: 0.9rem;
  border: 0;
  border-radius: 12px;
  background: #ffffff;
  display: grid;
  gap: 0.55rem;
}

.control-card--phase1-import {
  background: #e5e7eb;
  border-color: #cbd5e1;
  gap: 0.65rem;
}

.app__control-title {
  margin: 0;
  font-size: 1.02rem;
  color: #0f172a;
}

.control-note {
  margin: 0;
  font-size: 0.8rem;
  color: #6b7280;
  line-height: 1.45;
}

.controls .control-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.controls label {
  font-weight: 700;
  color: #0f172a;
  font-size: 0.92rem;
  line-height: 1.35;
  white-space: normal;
  flex: 1 1 10rem;
  min-width: 0;
}

.controls .group-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
  margin-left: auto;
  max-width: 100%;
}

.controls .app__group-select-shell {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.controls .app__group-select--native {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.controls .app__group-select-trigger {
  height: 44px;
  width: 124px;
  border-radius: 10px;
  font-size: 1.06rem;
  padding: 0 0.7rem 0 0.9rem;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #0f172a;
  text-align: center;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
}

.controls .app__group-select-trigger:focus-visible {
  outline: none;
  border-color: #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
}

.controls .app__group-select-trigger:disabled {
  color: #64748b;
  background: #f1f5f9;
  cursor: not-allowed;
}

.controls .app__group-select-trigger-value {
  flex: 1 1 auto;
}

.controls .app__group-select-trigger-caret {
  flex: 0 0 auto;
  font-size: 0.78rem;
  line-height: 1;
  color: #334155;
}

.controls .app__group-select-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  width: 124px;
  max-height: min(48vh, 300px);
  padding: 0.3rem;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.18);
  overflow: auto;
  z-index: 30;
}

.controls .app__group-select-option {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #0f172a;
  font-size: 0.98rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.controls .app__group-select-option:hover {
  background: #e6fffa;
}

.controls .app__group-select-option.is-selected {
  color: #ffffff;
  background: #0f766e;
}

.controls .app__group-select-option:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.35);
}

.controls .select-bracket {
  color: #0f172a;
  font-weight: 700;
  line-height: 1;
}

.controls #shuffle-button {
  width: 100%;
  justify-self: stretch;
  height: 46px;
  border: none;
  border-radius: 10px;
  padding: 0 1.2rem;
  font-size: 1.02rem;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  background: #0f766e;
  transition: opacity 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.controls #shuffle-button:disabled {
  opacity: 1;
  color: #e2e8f0;
  background: #94a3b8;
  cursor: default;
}

.shuffle-icon {
  font-size: 0.95rem;
  line-height: 1;
  transform: translateY(-0.5px);
}

.app__error-message {
  margin: 0;
  min-height: calc(1.45em * 2 + 0.25rem);
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  line-height: 1.45;
  font-weight: 700;
  color: #334155;
  word-break: break-word;
}

.app__error-message.is-error {
  color: #b91c1c;
}

.app__error-message.is-info {
  color: #0f766e;
}

.participants-guide,
.mic-on-guide {
  display: block;
  width: 100%;
  text-align: left;
  min-height: 1.2em;
  padding: 0;
  border-radius: 0;
  font-weight: 700;
  background: transparent;
  border: 0;
  line-height: 1.35;
}

.participants-guide {
  font-size: 0.95rem;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.mic-on-guide {
  font-size: 0.86rem;
  color: #0f766e;
  font-variant-numeric: tabular-nums;
  padding: 0.48rem 0.56rem;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 8px;
  background: #f8fbfa;
}

.error-message {
  min-height: 1.5em;
  margin: 0 0 1rem;
  font-weight: 600;
}

.error-message.is-error {
  color: #b91c1c;
}

.error-message.is-info {
  color: #0f766e;
}

.inputs,
.results {
  padding: 0.95rem;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 14px;
  background: #ffffff;
  margin-bottom: 0;
}

.inputs h2,
.results h2 {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
}

.inputs {
  min-height: min(78vh, 900px);
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
}

.inputs-head {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.inputs-head h2 {
  margin: 0;
  font-size: 18px;
}

.inputs-grid {
  flex: 1 1 auto;
  max-height: min(76vh, 780px);
  overflow: auto;
  scrollbar-gutter: stable;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
}

.app__section--additional .app__inputs-grid,
.app__section--additional .inputs-grid {
  max-height: min(20vh, 200px);
}

.inputs-note {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  color: #6b7280;
}

.inputs-note code {
  padding: 0.05rem 0.3rem;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 6px;
  background: #f5fbf9;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
}

.sheet-import {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding-bottom: 0;
}

.sheet-import button {
  height: 38px;
  border: none;
  border-radius: 8px;
  background: #0f766e;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  padding: 0 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

#go-phase2-button,
#shuffle-round1-button,
#shuffle-round2-button,
#prepare-round2-button {
  min-height: 46px;
  padding: 0 1.2rem;
  font-size: 1.02rem;
}

#go-phase2-button,
#prepare-round2-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#go-phase2-button {
  border: 0;
}

.sheet-import button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.paste-icon {
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
  transform: translateY(-3px);
}

.clipboard-message {
  margin: 0;
  height: calc(1.45em * 2 + 0.28rem);
  width: 100%;
  padding: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #334155;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.clipboard-message:not(.is-error) {
  display: flex;
  align-items: center;
}

.clipboard-message.is-error {
  display: flex;
  align-items: center;
  padding-top: 0;
}

.clipboard-message.is-info {
  color: #0f766e;
}

.clipboard-message.is-error {
  color: #b91c1c;
}

.input-sheet {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  table-layout: fixed;
  background: #ffffff;
  border: 0;
}

.input-sheet col.col-index {
  width: 52px;
}

.input-sheet col.col-name {
  width: 60%;
}

.input-sheet col.col-role {
  width: 40%;
}

.input-sheet thead th,
.input-sheet tbody th,
.input-sheet tbody td {
  border: 1px solid #d1d5db;
  padding: 0.3rem 0.4rem;
  vertical-align: middle;
}

.inputs-grid .input-sheet tr > *:first-child {
  border-left: 0;
}

.inputs-grid .input-sheet tr > *:last-child {
  border-right: 0;
}

.inputs-grid .input-sheet thead:first-child tr:first-child > *,
.inputs-grid .input-sheet tbody:first-child tr:first-child > * {
  border-top: 0;
}

.inputs-grid .input-sheet tbody tr:last-child > * {
  border-bottom: 0;
}

.input-sheet thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 0.83rem;
  font-weight: 700;
  color: #6b7280;
  background: #f2f7f5;
  text-align: center;
}

.input-sheet thead th:nth-child(2) {
  text-align: left;
}

.input-sheet td:nth-child(3) {
  text-align: center;
}

.header-index {
  width: 52px;
}

.participant-index {
  width: 52px;
  text-align: right;
  font-weight: 700;
  color: #0f172a;
  font-size: 0.9rem;
  background: #f8fafc;
}

.participant-name {
  width: 100%;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #ffffff;
  padding: 0 0.55rem;
  font-size: 0.92rem;
  min-width: 0;
}

.role-value {
  width: 100%;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #ffffff;
  padding: 0 0.45rem;
  font-size: 0.86rem;
  text-align: center;
}

.participant-name:focus,
.role-value:focus {
  outline: none;
  border-color: #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.15);
}

.participant-name:disabled,
.role-value:disabled {
  background: #f3f4f6;
  color: #6b7280;
}

.participant-name.is-readonly,
.participant-name[readonly] {
  background: #f3f4f6;
  color: #6b7280;
  cursor: not-allowed;
}

.draw-stage {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(15, 118, 110, 0.26);
  border-radius: 14px;
  background: linear-gradient(
    130deg,
    #0f766e 0%,
    #115e59 36%,
    #0ea5e9 65%,
    #f97316 100%
  );
  background-size: 190% 190%;
  animation: stage-gradient 6.2s ease-in-out infinite;
  padding: 1rem;
  color: #ffffff;
}

.draw-stage::before {
  content: "";
  position: absolute;
  inset: -35%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.22) 0%,
    rgba(255, 255, 255, 0.08) 26%,
    transparent 62%
  );
  transform: translate(-10%, -6%);
  animation: stage-orbit 7.2s linear infinite;
  pointer-events: none;
  z-index: 0;
}

.draw-stage > * {
  position: relative;
  z-index: 2;
}

.draw-glow,
.draw-scan {
  pointer-events: none;
  z-index: 1;
}

.draw-glow {
  position: absolute;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0.42;
}

.draw-glow-a {
  top: -62px;
  left: -34px;
  background: rgba(255, 255, 255, 0.42);
  animation: glow-drift-a 4.4s ease-in-out infinite alternate;
}

.draw-glow-b {
  right: -44px;
  bottom: -78px;
  background: rgba(251, 191, 36, 0.34);
  animation: glow-drift-b 5.1s ease-in-out infinite alternate;
}

.draw-scan {
  position: absolute;
  inset: -12%;
  background: linear-gradient(
    105deg,
    transparent 26%,
    rgba(255, 255, 255, 0.18) 47%,
    rgba(255, 255, 255, 0.06) 52%,
    transparent 72%
  );
  transform: translateX(-120%);
  animation: scan-sweep 2.3s ease-in-out infinite;
}

.draw-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.17);
  transform: translate(-50%, -50%);
  filter: blur(4px) saturate(115%);
  animation: pulse-ring 1.2s ease-out infinite;
}

.draw-pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
  animation: pulse-ring 1.2s ease-out infinite 0.46s;
}

.draw-title {
  position: relative;
  margin: 0;
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  font-weight: 800;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.32);
  animation: title-flicker 1.6s ease-in-out infinite;
}

.draw-subtitle {
  position: relative;
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
}

.draw-subtitle strong {
  font-size: 1.1rem;
  color: #ffeaa7;
}

.draw-phase {
  margin: 0.35rem 0 0;
  font-size: 0.79rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 700;
}

.draw-progress {
  position: relative;
  height: 10px;
  margin-top: 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}

.draw-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 38%,
    rgba(255, 255, 255, 0.52) 50%,
    transparent 72%
  );
  transform: translateX(-100%);
  animation: progress-sheen 1.4s linear infinite;
}

.draw-progress-bar {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #fef08a, #fff5bf 42%, #ffffff 100%);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.45);
  animation: fill-progress 5s linear forwards;
}

.draw-preview-groups {
  position: relative;
  margin: 0.95rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.6rem;
}

.draw-preview-group {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(1.5px);
  padding: 0.45rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
  animation: card-float 2s ease-in-out infinite;
  animation-delay: var(--group-delay, 0s);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.draw-preview-group h4 {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: #ecfeff;
  font-weight: 800;
}

.draw-preview-facilitator {
  margin: 0 0 0.35rem;
  padding: 0.18rem 0.32rem;
  border: 1px dashed rgba(255, 255, 255, 0.42);
  border-radius: 6px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(15, 23, 42, 0.16);
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.draw-preview-facilitator.is-locked {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.2);
  color: #fefce8;
}

.draw-preview-group.is-hot {
  border-color: rgba(255, 255, 255, 0.82);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 12px 24px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px) scale(1.01);
}

.draw-preview-members {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-height: 120px;
}

.draw-preview-member {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.18rem 0.35rem;
  animation: member-jitter 0.42s ease both;
  animation-delay: var(--member-delay, 0s);
}

.draw-preview-member small {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.86);
  white-space: nowrap;
}

.draw-preview-member.is-locked {
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.2);
}

.draw-preview-member-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 700;
}

.draw-preview-empty {
  padding: 0.22rem 0.3rem;
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.78);
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 1rem;
}

.group-grid > * {
  min-width: 0;
}

.draw-stage-plain {
  display: grid;
  width: 100%;
  gap: 0.9rem;
}

.draw-status-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 10px;
  background: #f8fbfa;
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
}

.draw-phase-text {
  color: #0f172a;
  font-weight: 700;
}

.draw-remaining {
  color: #334155;
  font-weight: 700;
}

.draw-remaining strong {
  color: #0f766e;
  font-size: 1.02rem;
}

.draw-progress-plain {
  height: 6px;
  border-radius: 999px;
  background: #e5ecea;
  overflow: hidden;
}

.draw-progress-plain-bar {
  display: block;
  width: 0;
  height: 100%;
  background: #0f766e;
  animation: fill-progress 5s linear forwards;
}

.draw-group-grid .group-card {
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.draw-group-grid .group-card.is-hot {
  border-color: rgba(15, 118, 110, 0.4);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.09);
  transform: translateY(-1px);
}

.draw-group-grid h3.is-locked {
  color: #0f766e;
}

.draw-group-card h3 {
  min-height: 1.25em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.draw-group-grid .draw-preview-empty {
  color: #64748b;
}

.draw-member {
  transition: background-color 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}

.draw-member.is-shuffling {
  border-style: dashed;
  opacity: 0.86;
  animation: shuffle-row 0.45s ease-in-out infinite alternate;
}

.draw-member.is-locked {
  border-style: solid;
  border-color: rgba(15, 118, 110, 0.28);
  background: #f0fdfa;
}

.group-card {
  width: 100%;
  min-width: 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f8fbfa);
}

.group-card h3 {
  max-width: 100%;
  margin: 0 0 0.4rem;
  font-size: 1rem;
  line-height: 1.25;
  min-height: 1.25em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #0f766e;
}

.group-card .group-meta {
  margin: 0 0 0.5rem;
  color: #6b7280;
  font-size: 0.8rem;
  font-weight: 700;
}

.group-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.group-card li {
  margin: 0.15rem 0;
}

.group-card .empty {
  color: #6b7280;
  font-style: italic;
}

.member-item {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid rgba(15, 118, 110, 0.15);
  border-radius: 8px;
  background: #ffffff;
  padding: 0.3rem 0.45rem;
}

.member-name {
  max-width: 100%;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.member-tags {
  flex: 0 0 auto;
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
}

.member-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.38rem;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
}

.member-tag.listener {
  color: #155e75;
  background: #e0f2fe;
}

.member-tag.facilitator {
  color: #7c2d12;
  background: #ffedd5;
}

.result-pop {
  animation: pop-in 0.45s ease-out both;
}

.result-placeholder {
  margin: 0;
  color: #6b7280;
}

.result-modal[hidden] {
  display: none;
}

.result-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #ffffff;
  display: flex;
  flex-direction: column;
}

.result-modal__panel {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.result-modal__header {
  border-bottom: 1px solid rgba(15, 118, 110, 0.16);
  background: #ffffff;
  padding: 0.7rem 0.85rem;
  position: sticky;
  top: 0;
  z-index: 2;
}

.result-modal__header-main {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: 1.35rem;
  min-height: 34px;
}

.result-modal__header-main h2 {
  grid-column: 1;
  margin: 0;
  font-size: 1.05rem;
  color: #0f172a;
  white-space: nowrap;
}

.result-modal.is-drawing #result-modal-title {
  color: #0f766e;
  animation: title-flicker 1.2s ease-in-out infinite;
}

.result-modal__draw {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-left: 0.3rem;
  padding-right: 0.45rem;
  min-width: 0;
  font-size: 0.84rem;
  line-height: 1.2;
  color: #0f172a;
}

.result-modal__draw[hidden] {
  display: none !important;
}

.result-modal__draw-phase {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  color: #0f766e;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 20ch;
}

.result-modal__draw-phase::before {
  content: "";
  width: 0.46rem;
  height: 0.46rem;
  border-radius: 999px;
  background: #0f766e;
  animation: blink-badge 0.65s ease-in-out infinite alternate;
  flex: 0 0 auto;
}

.result-modal__draw-remaining {
  color: #475569;
  font-weight: 700;
  white-space: nowrap;
}

.result-modal__draw-remaining strong {
  display: inline-block;
  min-width: 3ch;
  text-align: right;
  color: #0f766e;
  font-variant-numeric: tabular-nums;
}

.result-modal__draw-progress {
  flex: 0 0 clamp(140px, 17vw, 182px);
  min-width: 140px;
  max-width: 182px;
  height: 6px;
  border-radius: 999px;
  background: #dfebe8;
  overflow: hidden;
}

.result-modal__draw-progress-bar {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #0f766e, #14b8a6);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.08s linear;
}

.result-modal__actions {
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.result-modal__close {
  width: auto;
  min-width: 64px;
  height: 34px;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 9px;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0 0.75rem;
  line-height: 1;
  cursor: pointer;
}

.result-modal__close:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.result-modal__close--next {
  min-width: 132px;
  height: 34px;
  border-radius: 10px;
  padding: 0 1rem;
  font-size: 0.94rem;
  border-color: #0f766e;
  color: #ffffff;
  background: #0f766e;
}

.result-modal__close--next:disabled {
  border-color: #94a3b8;
  color: #e2e8f0;
  background: #94a3b8;
}

.result-modal__content {
  min-height: 0;
  padding: 0.75rem;
  overflow: auto;
}

.result-modal__content.is-fit-groups {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.5rem 0.75rem;
}

.result-modal.is-fit-groups .result-modal__panel {
  display: flex;
  flex-direction: column;
  height: 100vh;
  flex: 1;
  min-height: 0;
}

.result-modal.is-fit-groups .result-modal__content {
  flex: 1;
  min-height: 0;
}

.result-modal.is-fit-groups .result-groups-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.result-modal.is-fit-groups .result-groups-fit {
  flex: 1;
  min-height: 0;
}

.result-grid-fit {
  width: 100%;
}

.result-grid-fit.is-fit-25 {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.result-grid-fit.is-fit-25 .group-grid {
  position: static;
  flex: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: 0.75rem;
  align-content: start;
}

.result-grid-fit.is-fit-25 .group-card {
  display: flex;
  flex-direction: column;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  height: auto;
  box-sizing: border-box;
  overflow: visible;
}

.result-grid-fit.is-fit-25 .group-card h3 {
  margin: 0 0 0.3rem;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.result-grid-fit.is-fit-25 .group-card ul {
  flex: none;
  min-height: auto;
  display: grid;
  gap: 0.25rem;
  overflow: visible;
}

.result-grid-fit.is-fit-25 .group-card li {
  flex: none;
  min-height: auto;
  margin: 0;
  display: flex;
  align-items: center;
}

.result-grid-fit.is-fit-25 .member-item {
  width: 100%;
  gap: 0.3rem;
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
}

.result-grid-fit.is-fit-25 .member-name {
  font-size: 0.875rem;
}

.result-grid-fit.is-fit-25 .member-tag {
  padding: 0.1rem 0.3rem;
  font-size: 0.875rem;
}

@keyframes fill-progress {
  to {
    width: 100%;
  }
}

@keyframes stage-gradient {
  0% {
    background-position: 0% 42%;
  }
  50% {
    background-position: 100% 58%;
  }
  100% {
    background-position: 0% 42%;
  }
}

@keyframes stage-orbit {
  0% {
    transform: translate(-16%, -8%) rotate(0deg);
  }
  100% {
    transform: translate(-2%, -4%) rotate(360deg);
  }
}

@keyframes glow-drift-a {
  0% {
    transform: translate(0, 0) scale(0.95);
  }
  100% {
    transform: translate(28px, 20px) scale(1.08);
  }
}

@keyframes glow-drift-b {
  0% {
    transform: translate(0, 0) scale(0.96);
  }
  100% {
    transform: translate(-24px, -18px) scale(1.06);
  }
}

@keyframes scan-sweep {
  0% {
    transform: translateX(-120%);
    opacity: 0;
  }
  12% {
    opacity: 0.8;
  }
  60% {
    opacity: 0.45;
  }
  100% {
    transform: translateX(120%);
    opacity: 0;
  }
}

@keyframes pulse-ring {
  0% {
    transform: translate(-50%, -50%) scale(0.7);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.55);
    opacity: 0;
  }
}

@keyframes title-flicker {
  0%,
  100% {
    opacity: 1;
    transform: translateY(0);
  }
  50% {
    opacity: 0.88;
    transform: translateY(-0.5px);
  }
}

@keyframes blink-badge {
  0% {
    transform: scale(0.92);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes badge-glow {
  0%,
  100% {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.24);
  }
  50% {
    box-shadow: 0 4px 14px rgba(255, 255, 255, 0.38),
      0 6px 14px rgba(0, 0, 0, 0.2);
  }
}

@keyframes progress-sheen {
  to {
    transform: translateX(100%);
  }
}

@keyframes card-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

@keyframes member-jitter {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes shuffle-row {
  from {
    transform: translateX(-1px);
  }
  to {
    transform: translateX(1px);
  }
}

@keyframes pop-in {
  from {
    transform: translateY(8px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .controls {
    position: static;
    top: auto;
  }

  .inputs {
    min-height: auto;
  }

  .inputs-grid {
    max-height: min(60vh, 640px);
  }
}

@media (max-width: 600px) {
  .app {
    width: 100%;
    margin: 0;
    padding: 0.85rem;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .app-header {
    margin-bottom: 0.75rem;
  }

  .app-header h1 {
    font-size: 1.45rem;
  }

  .workspace {
    gap: 0.8rem;
  }

  .control-card {
    padding: 0.75rem;
    border-radius: 10px;
  }

  .inputs {
    padding: 0;
    border-radius: 0;
  }

  .app__phase1-next {
    padding: 0 0.75rem;
  }

  .controls > .app__ghost-button,
  .controls > .app__shuffle-button {
    width: calc(100% - 1.5rem);
  }

  .inputs-grid {
    max-height: min(55vh, 520px);
    overflow: auto;
  }

  .controls .control-line {
    gap: 0.35rem;
  }

  .controls label {
    font-size: 0.83rem;
    line-height: 1.35;
  }

  .controls .app__group-select-trigger {
    width: 112px;
    padding: 0 0.5rem 0 0.6rem;
  }

  .controls .app__group-select-menu {
    width: 112px;
  }

  .sheet-import {
    align-items: flex-start;
  }

  .clipboard-message {
    height: calc(1.45em * 2 + 0.28rem);
  }

  .participants-guide {
    font-size: 0.88rem;
  }

  .mic-on-guide {
    font-size: 0.8rem;
  }

  .group-grid,
  .draw-group-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .input-sheet {
    min-width: 560px;
  }

  .participant-name {
    height: 36px;
  }

  .result-modal__content {
    padding: 0.5rem;
  }
}
