* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f5f7fb;
  color: #1f2937;
  line-height: 1.5;
}

.wrap {
  max-width: 980px;
  margin: 40px auto;
  padding: 0 20px;
}

.card {
  background: #ffffff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

h1 {
  margin: 0 0 10px;
  font-size: 1.9rem;
}

h3 {
  margin-top: 18px;
  margin-bottom: 8px;
  font-size: 1rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eaf1ff;
  color: #1d4ed8;
  font-size: 0.92rem;
  font-weight: 600;
}

.section-title {
  margin: 26px 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
}

.aufgabe-box,
.hinweis-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
}

textarea {
  width: 100%;
  padding: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 1rem;
  resize: vertical;
  min-height: 160px;
}

textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.word-counter {
  margin-top: 8px;
  font-size: 0.95rem;
  color: #4b5563;
}

.word-limit-msg {
  margin-top: 6px;
  font-size: 0.92rem;
  color: #b91c1c;
  display: none;
}

.actions {
  margin-top: 22px;
}

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

.email-form {
  display: inline;
  margin: 0;
}

.print-only {
  display: none;
}

button {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 700;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: #1d4ed8;
}

button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.msg {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 0.97rem;
}

.msg.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.msg.success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.small-note {
  margin-top: 10px;
  color: #6b7280;
  font-size: 0.92rem;
}

.feedback-pre {
  white-space: pre-line;
}

.auswertung-box {
  margin-top: 10px;
}

.teilblock {
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.teilblock:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.fehler-tabelle {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  margin-bottom: 24px;
  background: #fff;
}

.fehler-tabelle th,
.fehler-tabelle td {
  border: 1px solid #d1d5db;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.fehler-tabelle th {
  background: #eef2ff;
  font-weight: 700;
}

.drop-zone {
  margin-bottom: 14px;
  padding: 18px;
  border: 2px dashed #93c5fd;
  border-radius: 12px;
  background: #eff6ff;
  text-align: center;
  cursor: pointer;
  transition: 0.2s ease;
}

.drop-zone.dragover {
  background: #dbeafe;
  border-color: #2563eb;
}

.drop-zone-small {
  font-size: 0.9rem;
  color: #6b7280;
}

@media (max-width: 640px) {
  .wrap {
    margin: 20px auto;
  }

  .card {
    padding: 18px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .fehler-tabelle th,
  .fehler-tabelle td {
    padding: 8px;
    font-size: 0.92rem;
  }
}

.upload-box {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid #dbe3f0;
  border-radius: 12px;
  background: #f8fafc;
}

.upload-label {
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 700;
}

.result-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 28px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

        .card h1 {
            text-align: center;
            margin-bottom: 32px;
            color: #1d4ed8;
        }

        .top-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 16px;
            flex-wrap: wrap;
            margin-bottom: 18px;
        }

        .top-field {
            margin-top: 10px;
            margin-bottom: 22px;
        }

        .top-field label {
            display: block;
            font-weight: 700;
            font-size: 1.05rem;
            margin-bottom: 10px;
        }

        .top-field input,
        .top-field select {
            width: 100%;
            padding: 12px 14px;
            border: 1px solid #cbd5e1;
            border-radius: 10px;
            font-size: 1rem;
        }

        .top-field input:focus,
        .top-field select:focus {
            outline: none;
            border-color: #2563eb;
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
        }

        .login-form {
            max-width: 420px;
            margin: 0 auto;
        }

        .login-status {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
            margin-bottom: 22px;
            padding: 12px 14px;
            border: 1px solid #dbe3f0;
            border-radius: 10px;
            background: #f8fafc;
            font-size: 0.95rem;
        }

        .login-status a {
            color: #1d4ed8;
            font-weight: 700;
            text-decoration: none;
        }

        .refine-form {
            margin-top: 22px;
            padding-top: 18px;
            border-top: 1px solid #e5e7eb;
        }

        .refine-actions {
            display: flex;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
        }

        .focus-wrap {
            margin-top: 28px;
            margin-bottom: 26px;
        }

        .focus-title {
            display: block;
            font-weight: 700;
            font-size: 1.05rem;
            margin-bottom: 12px;
        }

        .focus-block {
            border: 1px solid #dbe3f0;
            border-radius: 12px;
            padding: 16px;
            margin-bottom: 16px;
            background: #f8fbff;
        }

        .focus-grid {
            display: grid;
            grid-template-columns: 1.2fr 1.2fr 1.2fr 120px 1.2fr auto;
            gap: 12px;
            align-items: end;
        }

        .focus-grid .field label {
            display: block;
            font-weight: 600;
            margin-bottom: 6px;
        }

        .focus-grid .field input,
        .focus-grid .field select {
            width: 100%;
        }

        .block-remove {
            height: 44px;
            padding: 0 14px;
            border: none;
            border-radius: 10px;
            background: #e5e7eb;
            cursor: pointer;
            font-weight: 600;
        }

        .block-remove:hover {
            background: #d1d5db;
        }

        .add-row {
            margin-top: 8px;
        }

        .add-btn {
            border: none;
            border-radius: 10px;
            padding: 10px 14px;
            font-weight: 600;
            cursor: pointer;
            background: #e0ecff;
            color: #1d4ed8;
        }

        .add-btn:hover {
            background: #cfe2ff;
        }

        .wishes-area {
            min-height: 90px;
        }

        .output-box {
            white-space: pre-wrap;
        }

        .word-btn {
            border: none;
            border-radius: 10px;
            padding: 12px 16px;
            font-weight: 600;
            cursor: pointer;
            background: #1d4ed8;
            color: #ffffff;
        }

        .word-btn:hover {
            background: #1e40af;
        }

        .secondary-button {
            border: none;
            border-radius: 10px;
            padding: 12px 16px;
            font-weight: 600;
            cursor: pointer;
            background: #e5e7eb;
            color: #1f2937;
        }

.secondary-button:hover {
    background: #d1d5db;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.45);
}

.loading-overlay.is-visible {
  display: flex;
}

.loading-dialog {
  width: min(360px, 100%);
  padding: 22px;
  border-radius: 8px;
  background: #ffffff;
  color: #1f2937;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 14px;
  border: 4px solid #d1fae5;
  border-top-color: #0f766e;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

        @media print {
            body {
                background: #ffffff;
            }

            .wrap {
                max-width: none;
                margin: 0;
                padding: 0;
            }

            .card {
                box-shadow: none;
                border-radius: 0;
                padding: 0;
            }

            .no-print,
            .login-status,
            form,
            .msg,
            #ergebnisBereich,
            .result-head .result-actions,
            .loading-overlay {
                display: none !important;
            }

            .print-only {
                display: block;
            }

            .result-head {
                display: block;
                margin-top: 0;
            }

            .hinweis-box {
                border: 0;
                background: #ffffff;
                padding: 0;
            }
        }

        @media (max-width: 1100px) {
            .focus-grid {
                grid-template-columns: 1fr 1fr;
            }
        }

        @media (max-width: 700px) {
            .focus-grid {
                grid-template-columns: 1fr;
            }

            .block-remove {
                width: 100%;
            }

            .top-row {
                align-items: stretch;
            }

            .top-row .word-btn {
                width: 100%;
            }
        }
