/**
 * 百人一首 読み上げ
 * 共通部品は practice-focus.css（pf-）。ここには読み上げだけで使う見た目を置く。接頭辞: ym-
 * 机に置いて使うので、読み上げ中の操作は大きく、画面の下にまとめる。
 */

.ym {
    --ym-blue: #2F6FB5;
    --ym-pink: #E07A9B;
    --ym-yellow: #E3B92E;
    --ym-green: #3E9B5C;
    --ym-orange: #E8833A;
}

/* ============================
   設定画面
   ============================ */
.ym-styles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.ym-style {
    display: grid;
    gap: 4px;
    align-content: start;
    min-height: 88px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1.5px solid var(--pf-line);
    background: var(--pf-surface);
    color: var(--pf-ink);
    text-align: left;
    transition: border-color .15s, background-color .15s;
}
.ym-style b { font-size: 1rem; }
.ym-style small { font-size: 0.75rem; line-height: 1.5; color: var(--pf-ink-3); }
.ym-style:hover { border-color: var(--pf-ai); }
.ym-style[aria-pressed="true"] {
    border-color: var(--pf-ai);
    background: var(--pf-ai-soft);
    box-shadow: inset 0 0 0 1px var(--pf-ai);
}
.ym-style[aria-pressed="true"] b { color: var(--pf-ai); }

.ym-colors,
.ym-blocks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.ym-color {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 12px 0 10px;
    border-radius: 12px;
    border: 1.5px solid var(--pf-line);
    background: var(--pf-surface);
    color: var(--pf-ink);
    font-size: 0.9375rem;
}
.ym-color i,
.ym-colorlink i {
    width: 14px;
    height: 20px;
    border-radius: 3px;
    background: var(--ym-c);
}
.ym-color[aria-pressed="true"] {
    border-color: var(--ym-c);
    background: color-mix(in srgb, var(--ym-c) 12%, #fff);
    box-shadow: inset 0 0 0 1px var(--ym-c);
    font-weight: 700;
}
.ym-color--blue { --ym-c: var(--ym-blue); }
.ym-color--pink { --ym-c: var(--ym-pink); }
.ym-color--yellow { --ym-c: var(--ym-yellow); }
.ym-color--green { --ym-c: var(--ym-green); }
.ym-color--orange { --ym-c: var(--ym-orange); }
.ym-blocks .pf-chip { min-width: 0; padding: 0 12px; font-size: 0.875rem; }

.ym-note {
    margin: 8px 0 0;
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--pf-ink-3);
}
.pf-switch small a { color: var(--pf-ai); }
.ym-sound { margin-top: 10px; }

/* ============================
   読み上げ中
   ============================ */
.ym-histbtn:disabled { opacity: .4; cursor: default; }

.ym-play { padding: 0 16px; }
.ym-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    outline: none;
    overflow-y: auto;
}
.ym-ord {
    margin: 0;
    font-family: var(--pf-uta);
    font-weight: 600;
    font-size: clamp(4.5rem, 22vw, 8rem);
    line-height: 1;
    color: var(--pf-ai);
    font-variant-numeric: tabular-nums;
}
.ym-ord.is-joka { color: var(--pf-shu); }
.ym-phase {
    margin: 0;
    min-height: 1.6em;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--pf-ink-2);
}
.is-paused .ym-phase { color: var(--pf-shu); }
.ym-wait {
    width: min(100%, 280px);
    height: 6px;
    border-radius: 3px;
    background: var(--pf-line);
    overflow: hidden;
}
.ym-wait b { display: block; height: 100%; width: 0; background: var(--pf-ai); }

.ym-card {
    width: min(100%, 420px);
    padding: 16px 18px;
    border-radius: 16px;
    border: 1.5px solid var(--pf-line);
    background: var(--pf-surface);
    font-family: var(--pf-uta);
}
.ym-card p { margin: 0; }
.ym-card-kami { font-size: 1.0625rem; line-height: 1.7; color: var(--pf-ink-2); }
.ym-card-shimo { margin-top: 4px !important; font-size: 1.25rem; line-height: 1.7; font-weight: 600; }
.ym-card-meta { margin-top: 8px !important; font-family: var(--pf-ui); font-size: 0.75rem; color: var(--pf-ink-3); }
.ym-reveal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1.5px solid var(--pf-line);
    background: var(--pf-surface);
    color: var(--pf-ink-2);
    font-size: 0.8125rem;
}
.ym-reveal:hover { border-color: var(--pf-ai); color: var(--pf-ai); }

.ym-ctrl {
    flex: none;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 12px 0 calc(16px + env(safe-area-inset-bottom, 0px));
}
.ym-main {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 0;
    background: var(--pf-ai);
    color: var(--pf-ai-ink);
    display: grid;
    place-items: center;
    box-shadow: 0 6px 16px rgba(34, 66, 122, .25);
    transition: transform .08s;
}
.ym-main:active { transform: scale(.97); }
.ym-main .pf-svg { width: 34px; height: 34px; stroke-width: 2.2; }
.ym-main .ym-ic-play { fill: currentColor; }
.ym-ic-play { display: none; }
.is-paused .ym-ic-pause { display: none; }
.is-paused .ym-ic-play { display: block; }
.is-paused .ym-main { background: var(--pf-shu); box-shadow: 0 6px 16px rgba(194, 59, 34, .25); }
.ym-sub {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 72px;
    border-radius: 16px;
    border: 1.5px solid var(--pf-line);
    background: var(--pf-surface);
    color: var(--pf-ink);
    font-size: 0.875rem;
    font-weight: 700;
}
.ym-sub:hover { border-color: var(--pf-ai); }
.ym-sub--next { border-color: var(--pf-ai); color: var(--pf-ai); background: var(--pf-ai-soft); }

/* 読んだ札の一覧 */
.ym-hist { max-height: 80vh; grid-template-rows: auto 1fr auto; }
.ym-hist h2 small { font-size: 0.75rem; font-weight: 400; color: var(--pf-ink-3); margin-left: 6px; }
.ym-hist-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
    overflow-y: auto;
    min-height: 0;
}
.ym-hist-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--pf-line);
    background: var(--pf-surface);
    color: var(--pf-ink);
    text-decoration: none;
}
.pf .ym-hist-list li a { text-decoration: none; }
.ym-hist-list a:hover { border-color: var(--pf-ai); }
.ym-hist-ord {
    flex: none;
    min-width: 2em;
    font-size: 0.75rem;
    color: var(--pf-ink-3);
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.ym-hist-k { flex: none; min-width: 3.6em; font-family: var(--pf-uta); font-weight: 600; font-size: 1.125rem; }
.ym-hist-s { font-family: var(--pf-uta); font-size: 0.875rem; line-height: 1.45; }
.ym-hist-s small { display: block; font-family: var(--pf-ui); font-size: 0.6875rem; color: var(--pf-ink-3); }
.ym-hist-list--done { margin-bottom: 8px; }

/* PC: 練習ツールの2列配置（practice-focus.css）を使わず、縦1列に置く */
@media (min-width: 860px) {
    .pf-play.ym-play {
        display: flex;
        flex-direction: column;
        max-width: 640px;
        padding: 8px 32px 0;
    }
    .ym-ctrl { max-width: 480px; margin: 0 auto; width: 100%; }
    .ym-ord { font-size: 9rem; }
}

/* ============================
   読み終わり
   ============================ */
.ym-done-title { text-align: center; font-size: 1.375rem; margin-top: 8px; }

/* ============================
   説明（設定画面の下）
   ============================ */
.ym-guide {
    max-width: 720px;
    margin: 48px auto 0;
    font-family: var(--pf-ui);
    color: var(--pf-ink);
}
.ym-sec { margin-top: 36px; }
.ym-sec h2 {
    font-family: var(--pf-uta);
    font-size: 1.375rem;
    font-weight: 600;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--pf-line);
}
.ym-sec p { line-height: 1.85; color: var(--pf-ink-2); }
.ym-sec a { color: var(--pf-ai); }
.ym-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: ym-step;
    display: grid;
    gap: 10px;
}
.ym-steps li {
    counter-increment: ym-step;
    position: relative;
    display: grid;
    gap: 2px;
    padding: 14px 16px 14px 56px;
    border-radius: 14px;
    background: var(--pf-surface);
    border: 1px solid var(--pf-line-2);
}
.ym-steps li::before {
    content: counter(ym-step);
    position: absolute;
    left: 16px;
    top: 14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--pf-ai);
    color: #fff;
    font-weight: 700;
    display: grid;
    place-items: center;
    font-size: 0.875rem;
}
.ym-steps span { font-size: 0.875rem; line-height: 1.7; color: var(--pf-ink-2); }
.ym-table-wrap { overflow-x: auto; }
.ym-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    line-height: 1.6;
}
.ym-table th,
.ym-table td { padding: 10px 12px; border-bottom: 1px solid var(--pf-line); text-align: left; vertical-align: top; }
.ym-table thead th { background: var(--pf-ai-soft); color: var(--pf-ai); }
.ym-table tbody th { white-space: nowrap; color: var(--pf-ink-2); font-weight: 700; }
.ym-links { display: flex; flex-wrap: wrap; gap: 8px; }
.ym-colorlink {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 14px 0 10px;
    border-radius: 12px;
    border: 1.5px solid var(--pf-line);
    background: var(--pf-surface);
    font-size: 0.875rem;
    text-decoration: none;
}
.ym-sec .ym-colorlink { color: var(--pf-ink); }
.ym-colorlink:hover { border-color: var(--ym-c); }
.ym-faq { margin: 0; }
.ym-faq dt { font-weight: 700; margin-top: 16px; }
.ym-faq dt::before { content: 'Q. '; color: var(--pf-ai); }
.ym-faq dd { margin: 4px 0 0; line-height: 1.8; color: var(--pf-ink-2); font-size: 0.9375rem; }
.ym-more { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ym-more li {
    display: grid;
    gap: 2px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--pf-line);
    background: var(--pf-surface);
}
.ym-more a { font-weight: 700; }
.ym-more span { font-size: 0.75rem; color: var(--pf-ink-3); }

@media (max-width: 420px) {
    .ym-styles { grid-template-columns: 1fr; }
    .ym-style { min-height: 0; }
    .ym-main { width: 76px; height: 76px; }
}
