* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: '游明朝', 'Yu Mincho', 'YuMincho', 'Hiragino Mincho ProN', 'MS PMincho', serif;
    background: linear-gradient(135deg, #e8d5b7 0%, #d4a574 50%, #c89664 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    position: relative;
    margin: 0;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(90deg, rgba(139, 69, 19, 0.03) 0px, transparent 1px, transparent 40px, rgba(139, 69, 19, 0.03) 41px),
        repeating-linear-gradient(0deg, rgba(139, 69, 19, 0.03) 0px, transparent 1px, transparent 40px, rgba(139, 69, 19, 0.03) 41px);
    pointer-events: none;
    z-index: 0;
}

h1 {
    color: #5a3a1a;
    margin: 20px 0;
    font-size: 2.5em;
    text-shadow: 2px 2px 3px rgba(255, 255, 255, 0.5);
    font-weight: bold;
    letter-spacing: 0.1em;
    position: relative;
    z-index: 1;
}

.game-container {
    background: rgba(255, 250, 240, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 30px rgba(90, 58, 26, 0.3);
    max-width: 900px;
    width: 100%;
    border: 3px solid #d4a574;
    position: relative;
    z-index: 1;
}

.phase-indicator {
    text-align: center;
    font-size: 1.3em;
    color: #8b4513;
    margin-bottom: 20px;
    font-weight: bold;
}

.hand {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 30px 0;
    min-height: 180px;
}

.card {
    width: 140px;
    height: 160px;
    background: linear-gradient(to bottom, #fff9f0 0%, #f5e6d3 100%);
    border: 3px solid #a0826d;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    padding: 15px;
    text-align: center;
    line-height: 1.6;
    box-shadow: 0 3px 8px rgba(90, 58, 26, 0.2);
    color: #3a2a1a;
    position: relative;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(90, 58, 26, 0.3);
}

.card.selected {
    background: linear-gradient(to bottom, #ffe4b5 0%, #ffd89b 100%);
    border-color: #c0392b;
    transform: translateY(-15px);
    box-shadow: 0 12px 25px rgba(192, 57, 43, 0.3);
}

.card.five-chars {
    background: linear-gradient(to bottom, #fff9f0 0%, #f5e6d3 100%);
    border: 3px solid #c89664;
}

.card.seven-chars {
    background: linear-gradient(to bottom, #fffbf5 0%, #f0e8dc 100%);
    border: 3px solid #9a8270;
}

.card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: bold;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.card.five-chars .card-badge {
    background: linear-gradient(135deg, #c89664 0%, #b8936c 100%);
}

.card.seven-chars .card-badge {
    background: linear-gradient(135deg, #8b7355 0%, #6b5644 100%);
}

.card-text {
    margin-top: 5px;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
}

button {
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-draw {
    background: linear-gradient(to bottom, #8b7355 0%, #6b5644 100%);
    color: #fff9f0;
    border: 2px solid #5a4536;
}

.btn-exchange {
    background: linear-gradient(to bottom, #d4a574 0%, #b8936c 100%);
    color: #3a2a1a;
    border: 2px solid #a0826d;
}

.btn-complete {
    background: linear-gradient(to bottom, #c0392b 0%, #96281b 100%);
    color: #fff9f0;
    border: 2px solid #7f1d16;
}

.btn-reset {
    background: linear-gradient(to bottom, #cd853f 0%, #a0653f 100%);
    color: #fff9f0;
    border: 2px solid #8b5a3c;
}

.haiku-display {
    background: linear-gradient(to bottom, #f5e6d3 0%, #fff9f0 100%);
    border-radius: 8px;
    padding: 40px 30px;
    margin: 30px auto;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15), inset 0 0 20px rgba(139,69,19,0.05);
    min-height: 350px;
    max-width: 280px;
    display: none;
    position: relative;
    border: 3px solid #d4a574;
}

.haiku-display.show {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 25px;
}

.haiku-line {
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-size: 1.6em;
    line-height: 1.8;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: 0.3em;
    font-family: '游明朝体', 'Yu Mincho', 'YuMincho', 'ヒラギノ明朝 Pro', 'Hiragino Mincho Pro', 'MS P明朝', 'MS PMincho', serif;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.15);
    position: relative;
}

.haiku-line::after {
    content: '';
    position: absolute;
    right: -12px;
    top: 0;
    width: 1px;
    height: 100%;
    background: rgba(139,69,19,0.15);
}

.haiku-line:last-child::after {
    display: none;
}

.haiku-stamp {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
    border: 2px solid #8b0000;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: serif;
    font-size: 0.9em;
    color: white;
    font-weight: bold;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 0.1em;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.3), inset 1px 1px 2px rgba(255,255,255,0.3);
    transform: rotate(-3deg);
}

.instructions {
    background: rgba(245, 230, 211, 0.6);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    font-size: 0.9em;
    color: #5a3a1a;
    border: 2px solid #d4a574;
}

.instructions h3 {
    color: #8b4513;
    margin-bottom: 10px;
    font-weight: bold;
}

.instructions p {
    margin: 5px 0;
    line-height: 1.6;
}

.selected-count {
    text-align: center;
    color: #c0392b;
    font-weight: bold;
    margin: 10px 0;
    font-size: 1.1em;
}

.evaluation-display {
    background: linear-gradient(to bottom, #fff9f0 0%, #f5e6d3 100%);
    border-radius: 8px;
    padding: 25px;
    margin: 30px auto;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    border: 3px solid #d4a574;
    display: none;
    max-width: 600px;
}

.evaluation-display.show {
    display: block;
}

.evaluation-display h3 {
    color: #8b4513;
    margin-bottom: 15px;
    font-size: 1.4em;
    text-align: center;
    font-weight: bold;
}

.evaluation-display .evaluation-content {
    color: #3a2a1a;
    line-height: 1.8;
    font-size: 1.05em;
}

.evaluation-display .evaluation-content strong {
    font-weight: bold;
    color: #8b4513;
}

.evaluation-display .evaluation-content em {
    font-style: italic;
    color: #5a3a1a;
}

.evaluation-display .evaluation-content code {
    background-color: rgba(139, 69, 19, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
}

.evaluation-display .evaluation-content hr {
    border: none;
    border-top: 2px solid #d4a574;
    margin: 15px 0;
    opacity: 0.6;
}

.evaluation-display .loading {
    text-align: center;
    color: #8b4513;
    font-style: italic;
}

.evaluation-display .error {
    text-align: center;
    color: #c0392b;
    font-weight: bold;
}
