/* 耳トレ（聴覚反応速度トレーナー）スタイル */

/* ---- Layout ---- */

.et-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* ---- Settings panel ---- */

.et-settings-title {
    font-size: var(--text-2xl);
    font-weight: bold;
    text-align: center;
    margin-bottom: var(--space-8);
    font-family: var(--font-mincho);
}

.et-settings-group {
    margin-bottom: var(--space-6);
}

.et-settings-label {
    display: block;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

.et-settings-options {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.et-settings-option {
    padding: var(--space-2) var(--space-4);
    border: 1.5px solid var(--color-border);
    border-radius: 20px;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.et-settings-option.is-selected {
    border-color: var(--color-accent-primary);
    background: rgba(0, 113, 227, 0.08);
    color: var(--color-accent-primary);
    font-weight: 600;
}

.et-settings-start {
    margin-top: var(--space-8);
    text-align: center;
}

.et-howto {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.et-howto-step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.et-howto-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-accent-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.et-howto-sep {
    color: var(--color-border);
    font-size: var(--text-sm);
}

.et-audio-test {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-secondary, #f5f5f7);
    border-radius: var(--radius-md);
}

.et-audio-test-status {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

/* ---- Practice panel ---- */

.et-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.et-title {
    font-size: var(--text-lg);
    font-weight: bold;
    margin: 0;
}

.et-header-controls {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.et-progress {
    margin-bottom: var(--space-5);
}

.et-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-1);
}

.et-progress-bar {
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    overflow: hidden;
}

.et-progress-fill {
    height: 100%;
    background: var(--color-accent-primary);
    border-radius: 2px;
    transition: width 0.3s var(--ease-default);
}

/* Kami display (beginner mode) */
.et-kami {
    text-align: center;
    font-family: var(--font-mincho);
    font-size: var(--text-lg);
    color: var(--color-text-primary);
    min-height: 2em;
    margin-bottom: var(--space-4);
    letter-spacing: 0.1em;
}

/* Audio indicator */
.et-audio-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: 48px;
    margin-bottom: var(--space-5);
}

.et-audio-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-accent-primary);
    opacity: 0.3;
    transition: opacity 0.15s;
}

.et-audio-indicator.is-playing .et-audio-dot:nth-child(1) {
    animation: et-pulse 1.2s ease-in-out infinite;
}

.et-audio-indicator.is-playing .et-audio-dot:nth-child(2) {
    animation: et-pulse 1.2s ease-in-out 0.2s infinite;
}

.et-audio-indicator.is-playing .et-audio-dot:nth-child(3) {
    animation: et-pulse 1.2s ease-in-out 0.4s infinite;
}

.et-audio-indicator.is-playing .et-audio-dot:nth-child(4) {
    animation: et-pulse 1.2s ease-in-out 0.6s infinite;
}

.et-audio-indicator.is-playing .et-audio-dot:nth-child(5) {
    animation: et-pulse 1.2s ease-in-out 0.8s infinite;
}

@keyframes et-pulse {
    0%, 100% { opacity: 0.3; transform: scaleY(1); }
    50%       { opacity: 1;   transform: scaleY(2); }
}

/* Card grid — 4枚: 2×2, 8枚: 4×2 */
.et-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    max-width: 340px;
    margin: 0 auto;
}

.et-cards--hard {
    grid-template-columns: repeat(4, 1fr);
    max-width: 560px;
}

.et-cards .match-card {
    width: 100%;
    height: 150px;
    padding: var(--space-1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.et-shimo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.et-cards--hard .match-card {
    height: 120px;
}

/* Feedback */
.et-feedback {
    text-align: center;
    padding: var(--space-4);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    margin-top: var(--space-5);
}

.et-feedback-icon {
    font-size: 2rem;
    margin-bottom: var(--space-1);
}

.et-feedback-time {
    font-size: var(--text-2xl);
    font-weight: bold;
    color: var(--color-accent-primary);
}

.et-feedback-time-unit {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-left: 2px;
}

.et-feedback-diff {
    font-size: var(--text-sm);
    margin-top: var(--space-1);
}

.et-feedback-diff.is-faster { color: #34C759; }
.et-feedback-diff.is-slower { color: #FF9500; }

.et-feedback-poem {
    font-family: var(--font-mincho);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-top: var(--space-2);
    white-space: pre-line;
}

.et-feedback-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

/* ---- Result panel ---- */

.et-result {
    text-align: center;
    padding: var(--space-6) 0;
}

.et-result-icon {
    font-size: 3rem;
    margin-bottom: var(--space-2);
}

.et-result-title {
    font-size: var(--text-2xl);
    font-weight: bold;
    margin-bottom: var(--space-6);
    font-family: var(--font-mincho);
}

.et-result-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

.et-result-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
}

.et-result-stat-label {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

.et-result-stat-value {
    font-size: var(--text-2xl);
    font-weight: bold;
}

.et-result-slowest {
    text-align: left;
    margin: 0 auto var(--space-6);
    max-width: 320px;
}

.et-result-slowest-title {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

.et-slowest-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-sm);
    font-family: var(--font-mincho);
}

.et-slowest-time {
    color: #FF9500;
    font-weight: 600;
    font-family: var(--font-sans);
    flex-shrink: 0;
    margin-left: var(--space-3);
}

.et-result-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* ---- Dashboard panel ---- */

.et-dashboard {
    padding-bottom: var(--space-8);
}

.et-dashboard-title {
    font-size: var(--text-xl);
    font-weight: bold;
    margin-bottom: var(--space-6);
    font-family: var(--font-mincho);
}

.et-heatmap {
    margin-bottom: var(--space-8);
}

.et-heatmap-title {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-3);
}

.et-heatmap-group {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-3);
}

.et-heatmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
}

.et-heatmap-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-primary);
}

.et-heatmap-label small {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    font-weight: normal;
    margin-left: 4px;
}

.et-heatmap-avg {
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.et-heatmap-avg.is-fast      { background: rgba(52,199,89,0.15);  color: #1a8a38; }
.et-heatmap-avg.is-ok        { background: rgba(184,134,11,0.12); color: #8a6200; }
.et-heatmap-avg.is-slow      { background: rgba(255,149,0,0.15);  color: #cc7000; }
.et-heatmap-avg.is-very-slow { background: rgba(255,59,48,0.12);  color: #cc2a1f; }
.et-heatmap-avg.is-none      { background: var(--color-border);   color: var(--color-text-secondary); }

.et-heatmap-bar-wrap {
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    margin-bottom: var(--space-3);
    overflow: hidden;
}

.et-heatmap-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--color-border);
    transition: width 0.4s ease;
}

.et-heatmap-bar-fill.is-fast      { background: #34C759; }
.et-heatmap-bar-fill.is-ok        { background: #FFD60A; }
.et-heatmap-bar-fill.is-slow      { background: #FF9500; }
.et-heatmap-bar-fill.is-very-slow { background: #FF3B30; }

.et-heatmap-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.et-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-border);
    cursor: default;
    transition: transform 0.1s;
    position: relative;
}

.et-dot[title]:hover {
    transform: scale(1.3);
}

/* color by response time */
.et-dot.is-fast   { background: #34C759; }
.et-dot.is-ok     { background: #FFD60A; }
.et-dot.is-slow   { background: #FF9500; }
.et-dot.is-very-slow { background: #FF3B30; }

/* ---- Weak poems TOP 10 ---- */

.et-top10-title {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-3);
}

.et-top10-list {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-4);
}

.et-top10-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border);
}

.et-top10-rank {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.et-top10-poem {
    flex: 1;
    font-family: var(--font-mincho);
    font-size: var(--text-sm);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.et-top10-time {
    color: #FF9500;
    font-weight: 600;
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.et-top10-btn {
    padding: var(--space-1) var(--space-3);
    border: 1px solid var(--color-accent-primary);
    border-radius: 12px;
    background: transparent;
    color: var(--color-accent-primary);
    font-size: var(--text-xs);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.et-top10-btn:hover {
    background: rgba(0, 113, 227, 0.08);
}

.et-dashboard-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-top: var(--space-6);
}

/* no-data state */
.et-no-data {
    text-align: center;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    padding: var(--space-8) 0;
}
