* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, #f3f4f6 0%, #dbeafe 100%);
    min-height: 100vh;
}

.page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px;
}

.top-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.top-bar h1 {
    margin: 4px 0;
    color: #1f2937;
}

.poem-ticker {
    width: 100%;
    max-width: 760px;
    height: 44px;
    border-radius: 10px;
    border: 2px solid #334155;
    background: rgba(255, 255, 255, 0.9);
    overflow: hidden;
    position: relative;
}

.poem-line {
    position: absolute;
    white-space: nowrap;
    top: 50%;
    transform: translate(120%, -50%);
    left: 50%;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

.poem-line.enter-hold {
    animation: poemEnterHold 820ms ease-out forwards;
}

.poem-line.exit-left {
    animation: poemExitLeft 680ms ease-in forwards;
}

@keyframes poemEnterHold {
    from { transform: translate(120%, -50%); }
    to { transform: translate(-50%, -50%); }
}

@keyframes poemExitLeft {
    from { transform: translate(-50%, -50%); }
    to { transform: translate(-240%, -50%); }
}

.winner-banner {
    width: 100%;
    max-width: 760px;
    background: #f59e0b;
    color: #111827;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    border-radius: 10px;
    padding: 12px;
    border: 2px solid #b45309;
}

.hidden {
    display: none;
}

.game-layout {
    display: grid;
    grid-template-columns: 280px minmax(380px, 1fr) 280px;
    gap: 14px;
    align-items: start;
}

.panel {
    background: #ffffff;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.panel h2 {
    margin: 0 0 10px;
    font-size: 18px;
    color: #1f2937;
}

.item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
    color: #374151;
}

.item select {
    width: 150px;
    border: 1px solid #9ca3af;
    border-radius: 8px;
    padding: 6px 8px;
    background: #fff;
}

.item strong {
    color: #111827;
}

.buttons {
    display: flex;
    gap: 8px;
    margin: 14px 0;
}

button {
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-size: 14px;
    padding: 8px 12px;
    cursor: pointer;
}

button:hover {
    background: #1d4ed8;
}

button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.rule-note {
    margin: 4px 0 10px;
    font-size: 13px;
    color: #4b5563;
    line-height: 1.45;
}

.back-link {
    display: inline-block;
    color: #2563eb;
    text-decoration: none;
}

.board-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.board-shell {
    background: #d6a85c;
    border-radius: 12px;
    padding: 12px;
    box-shadow: inset 0 0 0 2px #8b5a2b, 0 8px 18px rgba(0,0,0,0.15);
}

#board {
    width: min(72vw, 760px);
    height: min(72vw, 760px);
    max-width: 760px;
    max-height: 760px;
    min-width: 360px;
    min-height: 360px;
}

.hint-text {
    margin: 0;
    font-size: 14px;
    color: #1f2937;
    min-height: 20px;
}

.trash-box {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 8px;
    margin-bottom: 10px;
    background: #f9fafb;
}

.trash-title {
    font-weight: 700;
    margin-bottom: 8px;
    color: #374151;
}

.trash-stones {
    min-height: 56px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.trash-stone {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 1px solid #111827;
}

.trash-stone.black {
    background: #111827;
}

.trash-stone.white {
    background: #ffffff;
}

.score-detail {
    border-top: 1px dashed #9ca3af;
    padding-top: 8px;
    color: #374151;
    font-size: 13px;
    line-height: 1.45;
    min-height: 56px;
}

.pin-dot {
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: #4b2e14;
}

.poem-display {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 12px;
    margin-top: 14px;
    background: #fefce8;
    min-height: 60px;
}

.poem-display-title {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
    border-bottom: 1px dashed #9ca3af;
    padding-bottom: 6px;
}

.poem-display-lines {
    font-size: 14px;
    color: #374151;
    line-height: 1.6;
}

.poem-display-line {
    margin: 2px 0;
}

.view-read-poems-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 8px 12px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.view-read-poems-btn:hover {
    background: #1d4ed8;
}

@media (max-width: 1100px) {
    .game-layout {
        grid-template-columns: 1fr;
    }

    #board {
        width: min(92vw, 760px);
        height: min(92vw, 760px);
        min-width: 300px;
        min-height: 300px;
    }
}
