* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #111827;
  min-height: 100vh;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  padding-bottom: 60px;
}

/* ===========================
   iOS STYLE TOAST NOTIFICATION
   =========================== */
.toast-notification {
  position: fixed;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(20px);
  color: white;
  padding: 16px 24px;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  z-index: 10000;
  transition: top 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  max-width: 90%;
  width: 420px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid rgba(255,255,255,0.08);
}

.toast-notification.show {
  top: 20px;
}

.toast-icon { font-size: 32px; flex-shrink: 0; }
.toast-content { flex: 1; min-width: 0; }
.toast-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.toast-message { font-size: 14px; opacity: 0.85; word-wrap: break-word; }

/* ===========================
   HEADER
   =========================== */
header {
  background: #1e293b;
  color: white;
  padding: 20px 20px;
  text-align: center;
  box-shadow: 0 2px 16px rgba(0,0,0,0.5);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  position: relative;
}

header.hidden { display: none; }

.header-content { position: relative; z-index: 1; }

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 10px;
}

.logo-img {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

header h1 {
  margin: 0;
  font-size: 2.2em;
  font-weight: 700;
  color: #f1f5f9;
}

.header-text {
  margin: 8px 0 14px 0;
  font-size: 1em;
  color: #64748b;
}

.header-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* ===========================
   FOOTER
   =========================== */
footer {
  background: #1e293b;
  color: #475569;
  padding: 16px 20px;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.06);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

footer.hidden { display: none; }
footer p { margin: 0; font-size: 13px; }

/* ===========================
   BUTTONS
   =========================== */
.button {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95em;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  white-space: nowrap;
}

.button:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,0.35); }
.button:active { transform: translateY(0); }

.back-button    { background: #334155; color: #e2e8f0; }
.info-button    { background: #1d4ed8; color: white; }
.primary-button { background: #16a34a; color: white; }
.secondary-button { background: #1d4ed8; color: white; }
.danger-button  { background: #dc2626; color: white; }
.start-button   { background: #16a34a; color: white; padding: 8px 16px; font-size: 0.88em; }
.pause-button   { background: #d97706; color: white; padding: 8px 16px; font-size: 0.88em; }
.reset-button   { background: #dc2626; color: white; padding: 8px 16px; font-size: 0.88em; }
.display-button { background: #7c3aed; color: white; padding: 8px 16px; font-size: 0.88em; }
.save-button    { background: #1d4ed8; color: white; }
.additional-host-button { background: #0d9488; color: white; }

/* ===========================
   ACTION SECTION
   =========================== */
.action-section {
  background: #1e293b;
  padding: 20px 24px;
  margin-top: 24px;
  margin-bottom: 24px;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: row;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  border-left: 4px solid #3b82f6;
}

.action-section .button { min-width: 180px; }

/* ===========================
   CONTAINER
   =========================== */
.container { animation: fadeIn 0.4s ease; flex: 1; }
.container.hidden { display: none; }

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

/* ===========================
   MAIN CONTENT
   =========================== */
#main-container {
  padding: 28px 20px;
  max-width: 1100px;
  margin: 0 auto;
  flex: 1;
  width: 100%;
}

/* ===========================
   SESSION SELECTION
   =========================== */
#session-selection {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
  text-align: center;
}

.card {
  background: #1e293b;
  padding: 28px;
  border-radius: 18px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
  width: 100%;
  max-width: 500px;
  transition: transform 0.25s ease;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.07);
}

.card:hover { transform: translateY(-3px); }

.card h2 { margin: 0 0 18px 0; color: #f1f5f9; font-size: 1.6em; font-weight: 700; }

.card input, .card select {
  width: 100%;
  padding: 13px;
  margin-bottom: 14px;
  background: #0f172a;
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  font-size: 1em;
  color: #f1f5f9;
  font-family: inherit;
  transition: border-color 0.2s;
}

.card input:focus, .card select:focus {
  outline: none;
  border-color: #3b82f6;
}

.card select option { background: #1e293b; color: #f1f5f9; }

.join-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 5px; align-items: center; }
.join-buttons .button { width: 100%; }

.divider {
  font-weight: 700;
  color: #475569;
  font-size: 1.1em;
  text-align: center;
  padding: 14px 0;
}

/* ===========================
   HOST VIEW
   =========================== */
.session-info {
  background: #1e293b;
  padding: 18px 22px;
  border-radius: 14px;
  margin-bottom: 18px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border: 1px solid rgba(255,255,255,0.07);
}

.session-info h2 { margin: 0; color: #f1f5f9; font-size: 1.5em; font-weight: 700; }
.session-info p { margin: 4px 0 0 0; color: #64748b; font-size: 1em; }
.session-info span { color: #22c55e; font-weight: 700; }

.current-display-status {
  background: #1e293b;
  padding: 18px 22px;
  border-radius: 14px;
  margin-bottom: 18px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  border-left: 4px solid #7c3aed;
}

.current-display-status h3 { margin: 0 0 14px 0; color: #a78bfa; font-size: 1.15em; font-weight: 700; }

#current-display-info {
  background: #0f172a;
  padding: 14px 18px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.display-timer-title { font-size: 1.1em; font-weight: 600; color: #e2e8f0; margin: 0; }
.display-timer-time  { font-size: 2em; font-weight: 900; color: #22c55e; font-variant-numeric: tabular-nums; margin: 0; }
.display-timer-status { font-size: 0.95em; font-weight: 600; color: #64748b; margin: 0; }
.display-timer-status.running { color: #22c55e; }

/* ===========================
   SECTIONS
   =========================== */
.section {
  background: #1e293b;
  padding: 22px;
  margin-bottom: 20px;
  border-radius: 18px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.06);
  transition: box-shadow 0.25s;
}

.section:hover { box-shadow: 0 6px 24px rgba(0,0,0,0.4); }
.section.blue   { border-left: 5px solid #3b82f6; }
.section.orange { border-left: 5px solid #f59e0b; }
.section.red    { border-left: 5px solid #ef4444; }

.section h2 {
  margin: 0 0 16px 0;
  color: #f1f5f9;
  font-size: 1.5em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section.blue h2::before   { content:''; width:8px; height:8px; background:#3b82f6; border-radius:50%; }
.section.orange h2::before { content:''; width:8px; height:8px; background:#f59e0b; border-radius:50%; }
.section.red h2::before    { content:''; width:8px; height:8px; background:#ef4444; border-radius:50%; }

/* ===========================
   TIMER BLOCKS
   =========================== */
.timer-block {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #0f172a;
  padding: 14px 16px;
  margin-top: 10px;
  border-radius: 12px;
  border: 1.5px solid rgba(255,255,255,0.07);
  transition: all 0.2s ease;
}

.timer-block:hover { background: #162032; }
.timer-block.active {
  background: #0c1a2e;
  border-color: #3b82f6;
  box-shadow: 0 0 16px rgba(59,130,246,0.15);
}

/* Drag & Drop: Programmpunkt wird gerade verschoben */
.timer-block.dragging {
  opacity: 0.4;
  border-color: #7c3aed;
  border-style: dashed;
}

/* Drag-Handle (Greifpunkt) zum Verschieben der Reihenfolge */
.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 32px;
  color: #475569;
  cursor: grab;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.drag-handle:hover {
  color: #94a3b8;
  background: rgba(255,255,255,0.06);
}

.drag-handle:active,
.timer-block.dragging .drag-handle {
  cursor: grabbing;
}

/* Timer info (links) */
.timer-info {
  flex: 1;
  min-width: 0;
}

.timer-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timer-title {
  font-weight: 600;
  color: #e2e8f0;
  font-size: 0.98em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timer-subtitle {
  display: block;
  font-size: 0.8em;
  color: #64748b;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bearbeiten-Stift */
.edit-btn {
  background: rgba(59,130,246,0.15);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: 6px;
  color: #60a5fa;
  cursor: pointer;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1;
}

.edit-btn:hover {
  background: rgba(59,130,246,0.3);
  border-color: rgba(59,130,246,0.6);
  color: #93c5fd;
}

/* Timer Zeit (mitte) */
.timer-time-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 80px;
}

.stopwatch {
  font-weight: 900;
  font-size: 1.5em;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  color: #22c55e;
  transition: color 0.4s ease;
}

.timer-target {
  font-size: 0.72em;
  color: #475569;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.buttons { display: flex; gap: 6px; flex-shrink: 0; }

/* ===========================
   ADD NEW TIMER SECTION
   =========================== */
.add-section {
  background: #1e293b;
  padding: 22px;
  margin-top: 24px;
  margin-bottom: 20px;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-left: 5px solid #7c3aed;
  border-top: 1px solid rgba(255,255,255,0.06);
  border-right: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.add-section h3 { margin: 0 0 6px 0; color: #a78bfa; font-size: 1.2em; font-weight: 700; }

.add-section select, .add-section input {
  padding: 11px 14px;
  border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,0.1);
  background: #0f172a;
  color: #f1f5f9;
  font-size: 1em;
  font-family: inherit;
  transition: border-color 0.2s;
}

.add-section select:focus, .add-section input:focus {
  outline: none;
  border-color: #7c3aed;
}

.add-section select option { background: #1e293b; }

/* ===========================
   CLIENT VIEW (VOLLBILD — Bühnen-iPad)
   =========================== */
.fullscreen-container {
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0a0f1a;
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  position: relative;
}

.leave-session-box {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 60px);
  max-width: 360px;
  z-index: 10;
}

.leave-session-box .button {
  width: 100%;
  font-size: 1em;
  padding: 12px 24px;
}

.current-timer-display {
  text-align: center;
  margin-top: 80px;
}

.current-timer-display h1 {
  font-size: clamp(1.8em, 4vw, 2.6em);
  margin: 0 0 6px 0;
  font-weight: 700;
  color: #f1f5f9;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* Subtitle auf Bühnen-iPad */
#current-timer-subtitle {
  font-size: clamp(1em, 2vw, 1.4em);
  color: #64748b;
  display: block;
  margin: 0 0 16px 0;
  min-height: 1.4em;
}

.mega-timer {
  font-size: clamp(7em, 16vw, 18em);
  font-weight: 900;
  margin: 20px 0;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #22c55e;
  transition: color 0.5s ease;
}

.status-indicator {
  font-size: clamp(1.3em, 2.5vw, 1.8em);
  margin-top: 16px;
  padding: 12px 28px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  display: inline-block;
  font-weight: 600;
  color: #64748b;
}

.status-indicator.running {
  background: rgba(34,197,94,0.12);
  border-color: rgba(34,197,94,0.3);
  color: #86efac;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}

/* ===========================
   TUTORIAL MODAL
   =========================== */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.25s ease;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 28px;
  border-radius: 18px;
  max-width: 680px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7);
  position: relative;
  animation: slideIn 0.25s ease;
  color: #e2e8f0;
}

@keyframes slideIn {
  from { transform: translateY(-40px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.close-modal {
  position: absolute;
  top: 18px; right: 22px;
  font-size: 32px;
  color: #64748b;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
}
.close-modal:hover { color: #f1f5f9; }

.modal-content h2 { margin: 0 0 22px 0; color: #f1f5f9; font-size: 1.8em; padding-right: 36px; }

.tutorial-section {
  margin-bottom: 26px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.tutorial-section:last-child { border-bottom: none; margin-bottom: 0; }
.tutorial-section h3 { color: #f1f5f9; font-size: 1.2em; margin: 0 0 12px 0; }
.tutorial-section h4 { color: #94a3b8; font-size: 1.05em; margin: 8px 0; }
.tutorial-section p  { color: #94a3b8; line-height: 1.7; margin: 8px 0; }
.tutorial-section ul,
.tutorial-section ol { color: #94a3b8; line-height: 1.8; margin: 8px 0; padding-left: 22px; }
.tutorial-section li { margin: 6px 0; }
.tutorial-section strong { color: #e2e8f0; }

.role-card {
  background: #0f172a;
  padding: 18px;
  border-radius: 10px;
  margin: 12px 0;
  border-left: 3px solid #3b82f6;
}
.role-card:last-child { border-left-color: #7c3aed; }
.role-card h4 { margin-top: 0; color: #e2e8f0; }
.role-card ul { margin-bottom: 0; }

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
  header h1 { font-size: 1.7em; }
  .logo-img { width: 44px; height: 44px; }

  .session-info { flex-direction: column; align-items: flex-start; }

  .timer-block {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
  }

  .timer-info { flex: 1 1 calc(100% - 100px); }
  .timer-time-col { min-width: 72px; }

  .buttons {
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: 5px;
  }

  .buttons .button {
    flex: 1 1 auto;
    padding: 7px 10px;
    font-size: 0.82em;
  }

  .toast-notification { width: calc(100% - 32px); }
  .modal-content { padding: 22px; width: 95%; }

  .header-buttons { flex-direction: column; width: 100%; align-items: center; }
  .header-buttons .button { width: 100%; max-width: 280px; }
}

@media (max-width: 480px) {
  header h1 { font-size: 1.4em; }
  .logo-img { width: 36px; height: 36px; }
  .fullscreen-container { padding: 16px; }
  .timer-block { padding: 10px; }
  .stopwatch { font-size: 1.25em; }

  .card { padding: 18px 14px; }
  .join-buttons .button { font-size: 0.88em; padding: 10px 14px; }
}