/* ── Tooltip (Number of Players) ── */
.tooltip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-left: 5px;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #FFD700;
    color: #7a5c00;
    font-size: 10px;
    font-weight: bold;
    font-family: Arial, sans-serif;
    cursor: default;
    line-height: 1;
    flex-shrink: 0;
    border: 1px solid #e6c200;
}

.tooltip-box {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #FFF9E6;
    color: #555;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.6;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 100;
    border: 1px solid #FFE082;
    box-shadow: 0 3px 10px rgba(0,0,0,0.10);
}

.tooltip-box::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #FFE082;
}

.tooltip-box::before {
    content: '';
    position: absolute;
    top: calc(100% - 1px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #FFF9E6;
    z-index: 1;
}

.tooltip-wrap:hover .tooltip-box {
    display: block;
}

/* ── / Tooltip ── */



.settings {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.word-input {
    margin-bottom: 20px;
}

.word-input textarea {
    width: 100%;
    height: 150px;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
}

.player-counter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 0.5rem;
}

.player-counter button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--primary-color);
    color: var(--text-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.player-counter button:hover {
    background: var(--primary-color);
    opacity: 0.9;
    transform: translateY(-1px);
}

.player-counter span {
    font-size: 1rem;
    min-width: 30px;
    text-align: center;
    font-weight: 500;
    color: var(--text-color);
}

/* Board Size 스타일 - 제목 아래 한 줄 띄우고 선택 옵션 가로 정렬 */
.options .option-group:first-child {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.options .option-group:first-child h2 {
    margin-bottom: 1rem;
    margin-top: 0;
}

.options .option-group:first-child .case-options {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

/* Font Size 중앙정렬 */
.options .option-group:nth-child(2) {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.options .option-group:nth-child(2) h2 {
    margin-bottom: 1rem;
    margin-top: 0;
}

.options .option-group:nth-child(2) .case-options {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

/* Inline checkboxes (Align to Top + Free Space) */
.options .option-group.option-checkboxes {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    padding: 0.5rem 0;
}

.check-option-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    color: #555;
    cursor: pointer;
    white-space: nowrap;
}

/* Number of Players 중앙정렬 */
.options .option-group:nth-child(4) {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.options .option-group:nth-child(4) h2 {
    margin-bottom: 1rem;
    margin-top: 0;
}

.options .option-group:nth-child(4) .player-counter {
    justify-content: center;
}

/* Preview Styles - override for multiple pages */
#puzzle-preview {
    width: auto !important;
    height: auto !important;
    min-height: auto !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
    display: block !important;
}

.bingo-page {
    background: white;
    width: 210mm;  /* A4 portrait width */
    height: 297mm;  /* A4 portrait height */
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 20mm;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1), 0 0 8px rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
    border-radius: 4px;
    margin: 0 auto 2rem auto;
    transform: scale(0.73);
    transform-origin: top center;
    min-height: 297mm;
    page-break-after: always;
}

/* Hide all pages except the first one in preview */
.bingo-page:not(:first-child) {
    display: none;
}

.page-divider {
    display: none;
}

.bingo-board {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
}

.bingo-board h2 {
    margin-bottom: 15px;
    text-align: center;
}

/* Student Header Styles */
.bingo-board .student-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10mm;
    margin-top: 0;
    padding: 0;
    width: 100%;
}

.bingo-board .header-left {
    display: flex;
    align-items: flex-start;
}

.bingo-board .puzzle-header {
    display: flex;
    align-items: center;
}

.bingo-board .preview-logo {
    height: 40px;
    margin-right: 1rem;
}

.bingo-board .info-group {
    display: flex;
    flex-direction: column;
    gap: 5mm;
    text-align: right;
}

.bingo-board .info-line {
    display: flex;
    align-items: baseline;
    font-size: 12pt;
    gap: 3mm;
    justify-content: flex-end;
}

.bingo-board .info-line label {
    font-weight: normal;
    min-width: 15mm;
}

.bingo-board .input-field {
    min-width: 50mm;
    height: 5mm;
    border-bottom: 0.2mm solid #999;
}

/* Puzzle Title Styles */
.bingo-board .puzzle-title {
    text-align: center;
    font-size: 24pt;
    font-weight: bold;
    margin: 5mm 0;
    padding: 0;
    min-height: 12mm; /* keeps space even when visibility:hidden */
}

.bingo-grid {
    border: 2px solid #000;
    display: grid;
    gap: 1px;
    background: #000;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1;
    margin-top: 5mm;
    grid-auto-rows: 1fr;
}

.bingo-cell {
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    font-size: 18px;
    text-align: center;
    height: 100%;
    word-break: break-word;
    box-sizing: border-box;
    overflow: hidden;
}

/* Free Space cell */
.bingo-cell.free-space {
    font-size: 4em !important;
}

/* Font size variations */
.bingo-board.font-small .bingo-cell {
    font-size: 15pt;
    padding: 10px;
    height: 100%;
}

.bingo-board.font-medium .bingo-cell {
    font-size: 18pt;
    padding: 10px;
    height: 100%;
}

.bingo-board.font-large .bingo-cell {
    font-size: 21pt;
    padding: 10px;
    height: 100%;
}

/* Word position variations - text alignment within each cell */
.bingo-board.pos-top .bingo-cell {
    align-items: flex-start;
    padding-top: 8px;
}

.bingo-board.pos-top .bingo-cell.free-space {
    align-items: center !important;
    padding-top: 0 !important;
}

.bingo-board.pos-middle .bingo-cell {
    align-items: center;
}

/* Print styles */
@media print {
    #puzzle-preview {
        width: auto !important;
        height: auto !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        transform: none !important;
    }

    .bingo-page {
        transform: none !important;
        margin: 0 !important;
        box-shadow: none !important;
        page-break-after: always;
        width: 210mm !important;
        height: 297mm !important;
        padding: 20mm !important;
        display: flex !important; /* Show all pages when printing */
    }
    
    .bingo-page:last-child {
        page-break-after: auto !important;
    }

    .bingo-page {
        padding-bottom: 15mm !important;
        position: relative !important;
    }

    .copyright-footer {
        position: absolute !important;
        bottom: 5mm !important;
        left: 0 !important;
        right: 0 !important;
        text-align: center !important;
        font-size: 8pt !important;
        color: #666 !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }

    .page-divider {
        border-left: 1px dashed #999;
    }

    .bingo-grid {
        border: 2px solid #000 !important;
        gap: 0 !important;
        background: transparent !important;
    }
    
    .bingo-cell {
        border-right: 1px solid #000 !important;
        border-bottom: 1px solid #000 !important;
        background: white !important;
    }
    
    .bingo-cell.last-col {
        border-right: none !important;
    }
    
    .bingo-cell.last-row {
        border-bottom: none !important;
    }
} 