:root {
  --bg-1: #f8f3e9;
  --bg-2: #f1eadb;
  --ink: #1f1b16;
  --muted: #6a6357;
  --line: #d4cab6;
  --card: rgba(255, 251, 242, 0.82);
  --accent: #0f7b6c;
  --accent-2: #e16e2b;
  --danger: #b33a3a;
  --shadow: 0 16px 50px rgba(28, 24, 19, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Plus Jakarta Sans", sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, rgba(248, 243, 233, 0.92), rgba(241, 234, 219, 0.92));
  background-blend-mode: overlay;
  position: relative;
  overflow-x: hidden;
  padding-bottom: 126px;
  
}

.app h2 {
  font-size: clamp(1.25rem, 1.8vw, 1.45rem);
  margin: 0;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  z-index: 0;
  filter: blur(2px);
  opacity: 0.55;
  animation: float 10s ease-in-out infinite;
}

.shape-a {
  width: 240px;
  height: 240px;
  background: #ffd49f;
  top: -60px;
  right: -50px;
}

.shape-b {
  width: 320px;
  height: 320px;
  background: #b7ead3;
  bottom: -140px;
  left: -80px;
  animation-delay: 1.5s;
}

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

.app {
  position: relative;
  z-index: 1;
  max-width: 1920px;
  margin: 0 auto;
  padding: 0px 16px 32px;
}

.hero {
  margin-bottom: 8px;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-direction: column;
}

.hero-logo {
  max-width: 440px;
  height: auto;
  margin: 0;
  display: block;
  /* filter: drop-shadow(0 2px 8px rgba(28, 24, 19, 0.1)); */
}

.eyebrow {
    
  display: block;
  margin: 0;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: clamp(1.1rem, 1.2vw, 1.2rem);
  letter-spacing: 0.6px;
  font-weight: 800;
  line-height: 1.1;
  color: #1f1b16;
  letter-spacing: 1.4px;
}

.sub {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.row + .row {
  margin-top: 10px;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

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

.primary {
  color: #fff;
  background: var(--accent);
}

.secondary {
  color: #fff;
  background: #24434b;
}

.danger {
  color: #fff;
  background: var(--danger);
}

.ghost {
  color: var(--ink);
  background: #efe8d8;
  border: 1px solid var(--line);
}

.file-label {
  font-size: 0.92rem;
  color: var(--muted);
}

input[type="file"] {
  font-size: 0.9rem;
}

.status {
  margin: 10px 2px 2px;
  font-weight: 600;
  color: #404040;
}

.status.compact {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}

.file-label.compact {
  background: #efe8d8;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 9px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #4f493f;
}

.sticky-tools input[type="file"] {
  font-size: 0.75rem;
  max-width: 178px;
}

.layout-full {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 14px;
}

.half {
  display: flex;
  flex-direction: column;
}

.left,
.right {
  padding: 14px;
  min-height: 720px;
}

h2 {
  margin: 0 0 4px;
  font-family: "Plus Jakarta Sans", sans-serif;
}

.muted {
  margin: 2px 0 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  flex: 1;
  overflow: auto;
}

.group-card {
  background: #faf7f1;
  border: 1px solid #e5d9c3;
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.group-header {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
  margin: 0 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #ddd0ba;
}

.group-members {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
  flex: 1;
  overflow-y: auto;
}

.member-row {
  padding: 3px 2px;
  line-height: 1.25;
  border-bottom: 1px dashed #ede4d1;
}

.member-row:last-child {
  border-bottom: none;
}

.member-badge {
  display: inline-block;
  background: #0f7b6c;
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 400;
  margin-right: 3px;
  font-size: 0.625rem;
}

.member-name {
  font-weight: 600;
}

.member-row.assigned .member-name {
  text-decoration: line-through;
  color: #9a907f;
}

.member-year {
  color: var(--muted);
  font-size: 0.7rem;
}

.teams-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  flex: 1;
  overflow: auto;
}

.team-card {
  background: #fefbf5;
  border: 1px solid #ddd0ba;
  border-radius: 10px;
  padding: 8px;
  animation: reveal 260ms ease;
}

.team-card.empty {
  background: rgba(255, 252, 245, 0.72);
  border-style: dashed;
}

.team-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e5d9c3;
}

.team-card-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--accent);
}

.team-card-pattern {
  font-size: 0.73rem;
  color: var(--muted);
  font-weight: 600;
}

.team-members-table {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
}

.team-member-row {
  display: grid;
  grid-template-columns: 32px 1fr 46px;
  gap: 6px;
  align-items: center;
  padding: 4px 2px;
  border-bottom: 1px dashed #ede4d1;
}

.team-member-row:last-child {
  border-bottom: 0;
}

.team-member-stt {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: #CA2128;
  border-radius: 4px;
  text-align: center;
  padding: 1px 0;
}

.team-member-name {
  font-weight: 600;
  line-height: 1.2;
}

.team-member-group {
  text-align: right;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.team-empty-row {
  padding: 8px 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-style: italic;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 20;
}

.modal.open {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 13, 10, 0.55);
  backdrop-filter: blur(3px);
}

.modal-panel {
  position: relative;
  width: min(480px, 100%);
  margin: 0;
  background: #fff8ea;
  border-radius: 20px;
  border: 1px solid #ddcfb3;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  padding: 2rem 1.5rem 1.75rem;
  text-align: center;
}

.modal-panel h3 {
  margin: 0;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1.45rem;
  margin-bottom: 2rem;
}

.draw-subtitle {
  margin: 6px 0 12px;
  color: var(--muted);
  text-align: center;
}

.draw-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.draw-slot {
  border: 1px solid #d7c8a9;
  border-radius: 14px;
  background: #fffcf4;
  min-height: 96px;
  padding: 10px;
  text-align: center;
}

.draw-slot-label {
  font-size: 0.7rem;
  color: var(--muted);
}

.draw-slot-name {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.35;
}

.draw-slot-name.placeholder {
  color: #998f7f;
  font-weight: 600;
}

.draw-slot.revealing {
  border-color: #db7f2f;
  box-shadow: inset 0 0 0 1px rgba(225, 110, 43, 0.3);
  animation: pulse 360ms ease infinite alternate;
}

.draw-slot.locked {
  border-color: #1d8f7f;
  background: #f3fffb;
}

@keyframes pulse {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.012);
  }
}

.modal-actions {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  gap: 10px;
}

#confirmDrawBtn {
  background: #CA2128;
  color: #fff;
  border: none;
}

.sticky-bottom {
        min-height: 72px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(248, 243, 233, 0.95), #f8f3e9);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
  z-index: 10;
  box-shadow: 0 -4px 12px rgba(28, 24, 19, 0.08);
}

.sticky-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.sticky-tools {
  min-height: 24px;
}

.sticky-tools .btn,
.sticky-tools .file-label.compact {
  font-size: 0.76rem;
  padding: 6px 9px;
}

.sticky-tools input[type="file"] {
  font-size: 0.7rem;
  max-width: 165px;
}

.sticky-tools .status.compact {
  font-size: 0.7rem;
  max-width: 320px;
}

/* ── Action buttons in sticky footer ── */
.sticky-btn {
  min-width: 148px;
  padding: 13px 22px;
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: 10px;
  letter-spacing: 0.01em;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 120ms ease;
}

#generateBtn {
  background: #CA2128;
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(202, 33, 40, 0.28);
}
#generateBtn:hover:not(:disabled) {
  background: #a81920;
  box-shadow: 0 4px 14px rgba(202, 33, 40, 0.38);
  transform: translateY(-1px);
  filter: none;
}

#resetBtn {
  background: #fff;
  color: #CA2128;
  border: 1.5px solid #CA2128;
  box-shadow: none;
}
#resetBtn:hover:not(:disabled) {
  background: #fff5f5;
  box-shadow: 0 2px 8px rgba(202, 33, 40, 0.14);
  transform: translateY(-1px);
  filter: none;
}

#exportBtn {
  background: #f5f0e8;
  color: #3a3026;
  border: 1.5px solid #c4b89e;
  box-shadow: none;
}
#exportBtn:hover:not(:disabled) {
  background: #ece4d4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
  filter: none;
}

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

  .groups-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .teams-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-panel {
    width: min(700px, 100%);
    margin: 0;
  }

  .draw-slots {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sticky-bottom {
    grid-template-columns: 1fr;
  }

  .sticky-row {
    justify-content: center;
  }

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

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

  body {
    padding-bottom: 164px;
  }

  .status.compact {
    max-width: 90vw;
    width: 100%;
    text-align: center;
  }
}
