* {
    font-family: "Inter";
}

body {
    margin: 0;
}

.input-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 20px;
}

.input-page h1 {
    font-size: 2rem;
}

.input-page input {
    padding: 12px 20px;
    font-size: 1.2rem;
    width: 400px;
    border: 2px solid #000;
    border-radius: 4px;
}

.input-page button {
    padding: 12px 30px;
    font-size: 1.2rem;
    border: 2px solid #000;
    border-radius: 4px;
    cursor: pointer;
    background-color: #f0f0f0;
}

.input-page button:hover {
    background-color: #ddd;
}

.info-text {
    color: #666;
    font-size: 0.9rem;
    max-width: 500px;
    text-align: center;
}

.error-msg {
    color: #c62828;
    font-size: 0.95rem;
    font-weight: 600;
    max-width: 500px;
    text-align: center;
    background-color: #ffebee;
    border: 1px solid #ef9a9a;
    border-radius: 4px;
    padding: 10px 16px;
}

.loading {
    color: #555;
    font-size: 0.95rem;
    text-align: center;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: center;
    border: 1px solid #000;
}

.table th {
    background-color: #f0f0f0;
    font-size: 1.8rem;
    white-space: nowrap;
}

.table .event-name {
    white-space: nowrap;
    text-align: left;
    font-weight: bold;
    vertical-align: middle;
}

.table .round-name {
    white-space: nowrap;
    font-weight: 600;
}

.table .sig-entry {
    border-right: none;
}

.table .sig-dc {
    border-left: none;
}

.info-hint {
    color: #888;
    font-size: 0.85rem;
    margin-left: auto;
}

.top-bar {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid #ddd;
}

.top-bar h2 {
    margin: 0;
}

.top-bar button {
    padding: 10px 24px;
    font-size: 1rem;
    border: 2px solid #000;
    border-radius: 4px;
    cursor: pointer;
    background-color: #f0f0f0;
}

.top-bar button:hover {
    background-color: #ddd;
}

button.saved {
    background-color: #e8f5e9 !important;
    border-color: #4caf50 !important;
}

.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 100;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #000;
    background: #f0f0f0;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.lang-btn {
    margin-left: auto;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: bold;
    border: 2px solid #000;
    border-radius: 4px;
    cursor: pointer;
    background-color: #f0f0f0;
}

.lang-btn:hover {
    background-color: #ddd;
}

.layout {
    display: flex;
    height: calc(100vh - 60px);
}

.sidebar {
    width: 280px;
    min-width: 280px;
    border-right: 1px solid #ddd;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
}

.sidebar h3 {
    margin: 0;
}

.sidebar input {
    padding: 8px 12px;
    font-size: 0.9rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.search-wrap {
    position: relative;
}

.search-wrap input {
    width: 100%;
    box-sizing: border-box;
    padding-right: 30px;
}

.clear-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #999;
    padding: 0 4px;
    line-height: 1;
}

.clear-btn:hover {
    color: #000;
}

.person-list {
    overflow-y: auto;
    flex: 1;
}

.person-item {
    padding: 6px 8px;
    font-size: 0.85rem;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
    cursor: grab;
}

.person-item:active {
    cursor: grabbing;
}

.person-item.dragging {
    opacity: 0.4;
    background-color: #e3f2fd;
}

.person-item.orga {
    background-color: #e8f5e9;
}

.person-item .wca-id {
    color: #999;
    font-size: 0.75rem;
}

.no-results {
    padding: 20px 8px;
    color: #999;
    text-align: center;
    font-size: 0.85rem;
}

.table-container {
    flex: 1;
    overflow: auto;
    padding: 16px;
}

.cell-input {
    width: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-family: "Inter";
    font-size: inherit;
    padding: 0;
    outline: none;
}

.cell-input:focus {
    background-color: #fffde7;
}

.cell-input.drag-over {
    background-color: #e8f5e9;
    outline: 2px dashed #4caf50;
}

@media print {
    @page {
        size: landscape;
        margin: 5mm;
    }

    body { margin: 0; }

    .table {
        width: 100%;
        border-collapse: collapse;
    }

    .table th,
    .table td {
        border: 1px solid #000;
        font-size: var(--print-font, 0.7rem);
        padding: calc(var(--print-font, 0.7rem) * 0.5) calc(var(--print-font, 0.7rem) * 0.8);
    }

    .table th {
        background-color: #e0e0e0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .table .round-name {
        font-size: 0.85em;
    }

    .table .sig-entry { border-right: none; }
    .table .sig-dc { border-left: none; }
    .table thead { display: table-header-group; }
    .table tr { page-break-inside: avoid; }

    .print-hide { display: none; }
    .layout { display: block; height: auto; }
    .sidebar { display: none; }
    .table-container { overflow: visible; padding: 0; }

    .cell-input {
        border: none;
        background: transparent;
    }

    .cell-print {
        font-family: "Inter";
        font-size: inherit;
    }
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .top-bar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }

    .top-bar h2 {
        font-size: 1rem;
        width: 100%;
    }

    .top-bar button {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .info-hint {
        display: none;
    }

    .layout {
        flex-direction: column;
        position: relative;
    }

    .sidebar {
        display: none;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        min-width: unset;
        max-height: 50vh;
        border-right: none;
        border-top: 2px solid #000;
        z-index: 99;
        background: #fff;
    }

    .sidebar.open {
        display: flex;
    }

    .person-list {
        max-height: 30vh;
    }

    .table-container {
        padding: 8px;
    }

    .table th {
        font-size: 1rem;
        padding: 8px 6px;
    }

    .table th,
    .table td {
        padding: 6px 4px;
    }

    .cell-input {
        font-size: 0.85rem;
    }

    .input-page input {
        width: 90%;
        max-width: 400px;
    }
}
