/* テストプレイ画面 */
.test-play-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.test-play-overlay.hidden {
    display: none;
}

.test-play-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.test-play-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ecf0f1;
}

.test-play-header h3 {
    color: #2c3e50;
    font-size: 1.8em;
    margin: 0;
}

.test-play-mode-panel {
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid #d9e5ec;
    border-radius: 12px;
    background: linear-gradient(135deg, #f7fbff, #eef5f8);
}

.test-play-mode-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.test-play-mode-label {
    font-weight: 800;
    color: #243746;
    letter-spacing: 0.02em;
}

.test-play-mode-toggle {
    display: inline-flex;
    gap: 6px;
    padding: 4px;
    border: 1px solid #cbd9e1;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.82);
}

.test-play-mode-btn {
    border: 0;
    border-radius: 7px;
    padding: 9px 14px;
    background: transparent;
    color: #516673;
    font-weight: 800;
    cursor: pointer;
}

.test-play-mode-btn.is-active {
    background: linear-gradient(135deg, #2f8ee5, #1769b7);
    color: #fff;
    box-shadow: 0 4px 10px rgba(47, 142, 229, 0.28);
}

.test-play-mode-description {
    margin: 10px 0 0;
    color: #516673;
    line-height: 1.5;
    font-size: 0.95em;
}

.test-play-input {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.test-play-field {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.test-play-input label {
    font-weight: bold;
    color: #2c3e50;
    min-width: 150px;
}

.test-play-field-label {
    font-weight: bold;
    color: #2c3e50;
    min-width: 150px;
}

.test-play-input input,
.test-play-input select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    background: #fff;
}

.test-play-input input {
    width: 100px;
}

.test-play-input select {
    min-width: 150px;
}

.test-play-inscription-field {
    gap: 10px;
}

.test-inscription-gauge-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.test-play-input .test-inscription-small-label {
    min-width: auto;
    font-size: 0.95em;
}

.test-play-input .test-inscription-gauge-input {
    width: 64px;
}

.test-inscription-hint {
    color: #607d8b;
    font-size: 0.9em;
}

.test-act-stack-label {
    color: #34495e;
    font-size: 0.92em;
    font-weight: 700;
    margin-left: 8px;
}

.test-act-stack-btn {
    padding: 7px 11px;
    min-height: 34px;
    font-size: 0.86em;
    line-height: 1;
    white-space: nowrap;
}

.test-act-stack-btn.special {
    background: linear-gradient(135deg, #8e44ad, #5b2c6f);
}

.test-act-stack-btn.inscription {
    background: linear-gradient(135deg, #1597d4, #0f5f9e);
}

.test-act-stack-btn.inscription.special {
    background: linear-gradient(135deg, #4f8ddf, #6d3ab2);
}

.test-act-stack-btn.aura {
    background: linear-gradient(135deg, #f39c12, #d35400);
}

.test-act-stack-btn.inscription-aura {
    background: linear-gradient(135deg, #00a8a8, #006d77);
}

.test-act-stack-btn.aura.is-on {
    background: linear-gradient(135deg, #35b8ff, #1268d6);
    box-shadow: 0 0 0 2px rgba(53, 184, 255, 0.18), 0 0 12px rgba(53, 184, 255, 0.42);
}

.test-act-stack-btn.inscription-aura.is-on {
    background: linear-gradient(135deg, #ff405f, #9d1835);
    box-shadow: 0 0 0 2px rgba(255, 64, 95, 0.18), 0 0 12px rgba(255, 64, 95, 0.42);
}

.test-act-stack-btn.aura.is-off,
.test-act-stack-btn.inscription-aura.is-off {
    background: linear-gradient(135deg, #7f8c8d, #4d5a5b);
    color: rgba(255, 255, 255, 0.92);
    box-shadow: none;
}

.test-play-input input:focus,
.test-play-input select:focus {
    outline: none;
    border-color: #3498db;
}

.test-add-fusion-btn {
    padding: 8px 14px;
    white-space: nowrap;
}

.state-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.state-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.state-section h5 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 1.1em;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
}

.test-hand, .test-place, .test-graveyard {
    min-height: 60px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.test-hand .card, .test-graveyard .card {
    width: 40px;
    height: 60px;
    font-size: 0.7em;
    margin: 0;
}

.test-place .card {
    width: 60px;
    height: 40px;
    font-size: 0.7em;
    margin: 0;
}

.test-place-field-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.test-place-cards-area {
    --test-place-stack-height: 78px;
    position: relative;
    min-height: var(--test-place-stack-height);
    min-width: 52px;
}

.test-place-cards-area .card {
    position: absolute;
    top: 0;
    left: 0;
    z-index: var(--test-place-card-z, 1);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    transform: translateY(var(--test-place-card-offset-y, 0px));
}

.test-place-cards-area .card:hover {
    transform: translateY(calc(var(--test-place-card-offset-y, 0px) - 2px));
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.test-place-stack {
    margin-bottom: 15px;
}

.test-play-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    justify-content: center;
}

.test-result-log {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 15px;
    border-radius: 8px;
    min-height: 100px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.4;
}

.test-result-log .success {
    color: #27ae60;
}

.test-result-log .error {
    color: #e74c3c;
}

.test-result-log .info {
    color: #3498db;
}

/* テストプレイ用カード選択状態 */
.card.selected {
    border: 3px solid #2196F3;
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}
