:root{
  --bg:#0b0d10;
  --panel: rgba(19, 24, 36, .92);
  --text:#eef2ff;
  --muted:#aab3c5;
  --border: rgba(255,255,255,.10);
  --shadow: 0 12px 30px rgba(0,0,0,.35);
  --accent:#ff2a2a;
}

*{box-sizing:border-box}
html{
  height: 100%;
  height: -webkit-fill-available;
  background: #0b0d10;
  max-width: 100vw;
  overflow-x: hidden;
}
body{
  height: 100%;
  margin: 0;
  color:var(--text);
  background: var(--bg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  max-width: 100vw;
}

.container{
  max-width: 100vw !important;
  padding: 12px;
  display: grid;
  gap: 12px;
}

.preview{
  display: block;
  width: calc(100vw - 28px);
  max-width: 99vw;
}

.input_panel{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.viewer{
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background:#000;
  display: flex;
  justify-content: center;
  width: calc(100vw - 20px);
  max-width: 99vw;
}

canvas{
  display:block;
  width:100%;
  height:auto;
}

.previewActions{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
  width: calc(100vw - 20px);
  max-width: 99vw;
}

.btn{
  height: 44px;         
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-weight: 700;
  letter-spacing: .2px;
  cursor: pointer;
}
.btn:active{ transform: translateY(1px); }

.btn--primary{
  border-color: rgba(255,42,42,.38);
  background: rgba(255,42,42,.12);
}

.form{ margin-top: 2px; }
.form__grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 100%;
}
.field--full{ grid-column: 1 / -1; }


@media (max-width: 380px){
  .form__grid{ grid-template-columns: 1fr; }
  .previewActions{ grid-template-columns: 1fr; }
  .options { grid-template-columns: 1fr; }
}

@media (max-width: 600px){
  .options { grid-template-columns: 1fr; }
  .btn--custom-image { align-self: auto; }
}

.field{ 
  display:grid;
  gap: 6px; 
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.field__label{ font-size: 12px; color: var(--muted); }

.field__control{
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
  color: var(--text);
  padding: 0 12px;
  font-size: 16px;
  outline: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.field__control:focus{ border-color: rgba(255,255,255,.22); }

.einsatzart {
    display: flex;
    flex-direction: column;
    gap: 10px;
    grid-column: 1 / -1;
}

.options {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.options .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.btn--custom-image {
    background: rgba(255, 255, 255, .05);
    padding: 0 12px;
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 0;
    transition: all 0.2s ease;
    align-self: flex-end;
}

.btn--custom-image:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn--danger {
    border-color: var(--accent);
    color: var(--accent);
}

.btn--danger:hover {
    background: rgba(255, 42, 42, 0.15);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    cursor: pointer;
}

.modal__content {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal__title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.modal__close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal__close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.modal__body {
    padding: 20px;
    flex: 1;
}

.modal__text {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: var(--muted);
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.02);
}

.upload-area:hover {
    border-color: var(--accent);
    background: rgba(255, 42, 42, 0.08);
}

.upload-area.drag-over {
    border-color: var(--accent);
    background: rgba(255, 42, 42, 0.12);
}

.upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    color: var(--accent);
    display: block;
}

.upload-text {
    margin: 0 0 4px 0;
    font-size: 16px;
    color: var(--text);
    font-weight: 600;
}

.upload-hint {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.uploaded-file-info {
    margin-top: 16px;
    padding: 12px;
    background: rgba(255, 42, 42, 0.1);
    border: 1px solid rgba(255, 42, 42, 0.2);
    border-radius: 8px;
}

.uploaded-file-text {
    margin: 0;
    font-size: 13px;
    color: var(--text);
}

.modal__footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
}

.modal__footer .btn {
    flex: 0 1 auto;
    min-width: 100px;
}