* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #f4f6f8;
  margin: 0;
  padding: 20px;
  color: #222;
}

.app-header {
  margin-bottom: 20px;
  text-align: center;
}

.app-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 10px;
}

.nav-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-tabs a {
  text-decoration: none;
}

.tab,
button {
  background: #e9eef6;
  color: #222;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
}

button.primary,
.tab.active {
  background: #2f6fed;
  color: white;
}

button.danger {
  background: #b00020;
  color: white;
}

button.small {
  font-size: 13px;
  padding: 5px 8px;
  border-radius: 6px;
}

button:hover,
.tab:hover {
  filter: brightness(0.95);
}

.container {
  max-width: 900px;
  margin: auto;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

h2 {
  margin-top: 0;
}

select,
input,
textarea {
  font-size: 16px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  width: 100%;
  max-width: 360px;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

label {
  display: inline-block;
  margin-bottom: 6px;
}

.form-row {
  margin-bottom: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  margin-top: 15px;
}

th {
  background: #eef2f7;
}

td,
th {
  border: 1px solid #ddd;
  padding: 10px;
  text-align: center;
}

td {
  cursor: pointer;
  transition: background 0.2s;
}

td:hover {
  background: #f0f6ff;
}

#weekInfo {
  max-width: 900px;
  margin: 0 auto 10px auto;
  background: #eef2f7;
  padding: 10px;
  border-radius: 8px;
  font-weight: 500;
}

#freeDevices {
  background: #fafafa;
  border-radius: 8px;
  padding: 12px;
  margin-top: 20px;
  font-family: monospace;
}

.device-Boden { background:#FFD166; }
.device-Filz { background:#FFE29A; }
.device-Sprung { background:#FF9F80; }
.device-Balken { background:#CDB4DB; }
.device-Reck { background:#90DBF4; }
.device-Stufenbarren { background:#98F5E1; }
.device-Ringe { background:#F1C0E8; }
.device-Trampolin { background:#B5E48C; }
.device-Pauschenpferd { background:#FDE2A7; }
.device-Barren { background:#A0C4FF; }

.day-block {
  margin-bottom: 15px;
}

.slot-card,
.thread-card,
.content-card {
  background: #f7f9fc;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.slot-title,
.thread-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.device-container {
  display: flex;
  flex-wrap: wrap;
}

.device-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  margin: 3px;
  font-size: 14px;
  font-weight: 600;
  color: #222;
}

.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border: 1px solid #aaa;
  border-radius: 12px;
  padding: 20px;
  z-index: 9999;
  min-width: min(420px, calc(100vw - 40px));
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.thread-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.thread-card {
  cursor: pointer;
  border-left: 8px solid var(--thread-color, #2f6fed);
}

.thread-meta,
.muted {
  color: #666;
  font-size: 14px;
}

.thread-view-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.content-card {
  white-space: normal;
}

.error {
  color: #b00020;
  margin-top: 8px;
}

@media (max-width: 700px) {
  body {
    padding: 12px;
  }

  table {
    font-size: 12px;
  }

  td,
  th {
    padding: 6px;
  }

  .container {
    padding: 15px;
  }
}

.thread-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.thread-card-top .thread-title {
  margin-bottom: 0;
}

.thread-header-actions {
  margin-top: 0;
}

button.danger {
  background: #b00020;
  color: white;
}

button.small {
  font-size: 13px;
  padding: 6px 10px;
}

.item-content {
  white-space: pre-wrap;
}

.item-actions {
  margin-top: 8px;
}

.reply-list {
  margin-top: 12px;
  margin-left: 22px;
  padding-left: 14px;
  border-left: 4px solid #c7d6eb;
}

.reply-card {
  background: #f3f7fd;
  border: 1px solid #d7e2f0;
  border-left: 5px solid #7e99c6;
  margin-top: 10px;
  margin-bottom: 0;
}

.reply-indicator {
  display: inline-flex;
  align-items: center;
  margin-bottom: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e3edf9;
  color: #365477;
  font-size: 13px;
  font-weight: 700;
}

.thread-file-section {
  margin: 18px 0 22px;
  padding: 14px;
  border: 1px solid #dfe7f1;
  border-radius: 12px;
  background: #fbfcfe;
}

.thread-file-header h3 {
  margin: 0 0 6px;
}

.thread-file-header .muted {
  margin: 0 0 12px;
}

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

#threadFileInput {
  width: min(100%, 440px);
  max-width: none;
}

.thread-file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.thread-file-card {
  background: #f7f9fc;
  border: 1px solid #e1e7ef;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.thread-file-preview {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  background: #eef2f7;
  margin-bottom: 10px;
}

.thread-file-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 140px;
  border-radius: 8px;
  background: #eef2f7;
  color: #52606d;
  font-weight: 600;
  margin-bottom: 10px;
}

.thread-file-name {
  font-weight: 600;
  word-break: break-word;
  margin-bottom: 6px;
}

.thread-file-actions {
  margin-top: 10px;
}

.link-button {
  display: inline-block;
  background: #e9eef6;
  color: #222;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  text-decoration: none;
}

.link-button.small {
  font-size: 13px;
  padding: 6px 10px;
}

.link-button:hover {
  filter: brightness(0.95);
}

@media (max-width: 700px) {
  .thread-file-preview,
  .thread-file-placeholder {
    height: 120px;
  }
}


.thread-checklist-section {
  margin: 18px 0 22px;
  padding: 14px;
  border: 1px solid #dfe7f1;
  border-radius: 12px;
  background: #fbfcfe;
}

.thread-checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.thread-checklist-header h3 {
  margin: 0 0 6px;
}

.thread-checklist-header .muted {
  margin: 0;
  max-width: 580px;
}

.thread-checklists {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.checklist-card {
  background: #f7f9fc;
  border: 1px solid #e1e7ef;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.checklist-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.checklist-card-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.checklist-items {
  display: grid;
  gap: 8px;
}

.checklist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px;
  border-radius: 9px;
  border: 1px solid #e2e7ef;
  background: white;
}

.checklist-item.claimed {
  border-left: 5px solid #0f9d58;
  background: #f4fbf7;
}

.checklist-item.free {
  border-left: 5px solid #bcc7d6;
}

.checklist-item-main {
  flex: 1 1 260px;
  min-width: 0;
}

.checklist-item-text {
  font-weight: 600;
  white-space: pre-wrap;
  word-break: break-word;
}

.checklist-item-claim {
  margin-top: 4px;
  font-size: 14px;
  color: #28543b;
}

.checklist-item-actions {
  margin-top: 0;
}

#checklistItemsInput {
  width: 100%;
  max-width: 100%;
  min-height: 170px;
}

@media (max-width: 700px) {
  .checklist-item-actions {
    width: 100%;
  }
}

.floor-music-upload-section {
  margin: 18px 0 22px;
  padding: 14px;
  border: 1px solid #dfe7f1;
  border-radius: 12px;
  background: #fbfcfe;
}

.floor-music-upload-section h3,
.floor-music-list-section h3 {
  margin-top: 0;
}

.floor-music-name-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.floor-music-name-grid input {
  max-width: 100%;
}

#floorMusicAudioInput {
  width: min(100%, 520px);
  max-width: none;
}

.floor-music-title-preview {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid #dfe7f1;
  border-radius: 10px;
  background: white;
}

.floor-music-title-preview-text {
  margin-top: 4px;
  font-weight: 700;
  word-break: break-word;
}

.floor-music-list-section {
  margin-top: 24px;
}

.floor-music-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.floor-music-card {
  background: #f7f9fc;
  border: 1px solid #e1e7ef;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.floor-music-card-title {
  font-weight: 700;
  margin-bottom: 6px;
  word-break: break-word;
}

.floor-music-player {
  display: block;
  width: 100%;
  margin-top: 12px;
}

.floor-music-card-actions {
  margin-top: 10px;
}

.legal-footer {
  max-width: 900px;
  margin: 12px auto 0;
  text-align: center;
  font-size: 13px;
}

.legal-footer a {
  color: #666;
  text-decoration: none;
}

.legal-footer a:hover {
  text-decoration: underline;
}

.privacy-content h3 {
  margin-top: 24px;
  margin-bottom: 8px;
}

.privacy-content p,
.privacy-content li {
  line-height: 1.55;
}

.privacy-content ul {
  padding-left: 22px;
}

