/* ==========================================================================
   render app design system — mirrors experiment/static/experiment/css/experiment.css
   conventions (flat class names, small keyframe vocabulary) with an "rt-" prefix.
   Brand hue: warm red -> orange (distinct from experiment's orange -> yellow),
   mascots + cream speech-bubbles kept, photographic backgrounds dropped in favor
   of a flat, light canvas.
   ========================================================================== */

/* ── ページ全体 ───────────────────────────────────────── */
body {
    font-family: 'Noto Sans JP', '游ゴシック体', 'Yu Gothic', sans-serif;
    background: #eee7da;
    color: #4a4238;
}

.rt-main {
    padding: 28px 12px 48px;
    min-height: 70vh;
}

.rt-footer {
    padding: 16px 12px 32px;
    font-size: 0.85rem;
    color: #777;
}

/* ── アニメーション定義 ───────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes floatChar {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-14px); }
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 4px 12px rgba(255,107,53,0.35); }
    50%       { box-shadow: 0 4px 28px rgba(255,107,53,0.75); }
}
@keyframes bounceIn {
    0%   { transform: scale(0.3); opacity: 0; }
    50%  { transform: scale(1.05); }
    80%  { transform: scale(0.97); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes ripple {
    to { transform: scale(4); opacity: 0; }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ヘッダー ─────────────────────────────────────────── */
.rt-header {
    background: linear-gradient(90deg, #e53935, #ff8a3d);
    color: white;
    padding: 11px 20px;
    box-shadow: 0 2px 10px rgba(229,57,53,0.3);
}
.rt-header-title {
    color: white;
    font-weight: bold;
    font-size: 1.15rem;
}
.rt-header-title:hover { color: white; opacity: 0.9; }
.rt-header-title small { font-weight: normal; opacity: 0.85; }
.rt-header-right .btn {
    border-radius: 999px;
}

/* ── カード（一覧・入場アニメーション） ──────────────── */
.rt-card {
    animation: fadeInUp 0.45s ease both;
    background: #f8f3ea;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: none;
    overflow: hidden;
}
.rt-card:nth-child(2) { animation-delay: 0.08s; }
.rt-card:nth-child(3) { animation-delay: 0.16s; }

/* ── マスコット ───────────────────────────────────────── */
.rt-mascot {
    max-width: 220px;
    width: 100%;
    height: auto;
}
.rt-mascot--sm { max-width: 120px; }
.rt-mascot--lg { max-width: 300px; }
.rt-mascot--float { animation: floatChar 3.2s ease-in-out infinite; }

/* ── 吹き出し（render用フォントサイズ調整） ──────────── */
.speech-bubble { font-size: 1.1rem; }
@media (max-width: 576px) {
    .speech-bubble { font-size: 1rem; }
}

/* ── 案内・注意書きボックス ───────────────────────────── */
.rt-callout {
    background: #fff8ec;
    border: 2px solid #ffd3c0;
    border-radius: 14px;
    padding: 14px 20px;
    font-weight: bold;
}
.rt-callout.callout-warn { background: #fffbea; border-color: #ffe08a; }
.rt-callout.callout-danger { background: #fff0ee; border-color: #ffb4a8; color: #c0392b; }

/* ── レイアウト補助（customcard相当） ─────────────────── */
.rt-custom-card {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}
.rt-w-30 { width: 30%; }
.rt-w-50 { width: 50%; }
.rt-w-70 { width: 70%; }
.rt-w-100 { width: 100%; }
@media (max-width: 768px) {
    .rt-custom-card { flex-direction: column; }
    .rt-custom-card .rt-w-30 { order: 2; }
    .rt-custom-card .rt-w-100 { order: 1; }
    .rt-custom-card .rt-w-30,
    .rt-custom-card .rt-w-50,
    .rt-custom-card .rt-w-70,
    .rt-custom-card .rt-w-100 { width: 100% !important; }
}

/* ── ボタン ───────────────────────────────────────────── */
.rt-btn-cta {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #ff6b35, #ffc300);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-weight: bold;
    animation: pulse-glow 2.4s ease-in-out infinite;
    transition: transform 0.15s;
}
.rt-btn-cta:hover { color: #fff; transform: scale(1.03); }
.rt-btn-cta::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 10px; height: 10px;
    background: rgba(255,255,255,0.4);
    border-radius: 50%;
    transform: translate(-50%,-50%) scale(0);
    opacity: 0;
}
.rt-btn-cta:active::after { animation: ripple 0.5s linear; }
.rt-btn-pill { border-radius: 999px; }

/* ── フォーム部品（select / input を統一デザインに） ─── */
.rt-main .form-control {
    border: 2px solid #ddd;
    border-radius: 12px;
    box-shadow: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.rt-main .form-control:focus {
    border-color: #ff6b35;
    box-shadow: 0 0 0 0.2rem rgba(255,107,53,0.2);
    outline: none;
}
.rt-header-right .form-control {
    border-radius: 999px;
    border: none;
    padding: 0.4rem 1rem;
}
.rt-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #f8f3ea;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='%23ff6b35' d='M8 11 3 6h10z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 14px;
    border: 2px solid #ffd3c0;
    border-radius: 999px;
    padding: 0.5rem 2.6rem 0.5rem 1.4rem;
    font-weight: bold;
    color: #c0440e;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.rt-select:hover { border-color: #ff8a3d; }
.rt-select:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 0.2rem rgba(255,107,53,0.25);
}
.rt-input {
    border: 2px solid #ddd;
    border-radius: 12px;
    padding: 0.5rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.rt-input:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 0.2rem rgba(255,107,53,0.2);
}

/* ── 共有リンク ───────────────────────────────────────── */
.rt-share-link {
    cursor: pointer;
    color: #0d6efd;
    text-decoration: underline;
    font-weight: 600;
}
.rt-share-link:hover { color: #ff6b35; }

/* ── 360°ビューワー ───────────────────────────────────── */
.rt-viewer-360 {
    border-radius: 12px;
    overflow: hidden;
    background: #f2f2f2;
    border: 2px solid #e0e0e0;
    transition: border-color 0.2s;
}
.rt-viewer-360:hover { border-color: #ff6b35; }

/* ── 評価カード／ボタン（A/B/C） ──────────────────────── */
.rt-eval-card {
    border: 3px solid #ddd6c8;
    border-radius: 14px;
    background: #f8f3ea;
    transition: border-color 0.25s, background-color 0.3s, transform 0.15s;
}
.rt-eval-card:hover { transform: translateY(-2px); }
.rt-eval-card.is-rated-A { border-color: #ff6b35; background: #fff3ee; }
.rt-eval-card.is-rated-B { border-color: #3a86ff; background: #eef2ff; }
.rt-eval-card.is-rated-C { border-color: #ffc300; background: #fffbea; }
.rt-eval-card.is-selected { border-color: #ff6b35; background: #fff3ee; }

.rt-eval-btn-group {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}
.rt-eval-btn-group .form-check {
    flex: 1;
    display: flex;
    padding: 0;
    margin: 0;
}
.rt-eval-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 64px;
    border-radius: 12px;
    font-size: 1.7rem;
    font-weight: 900;
    background: #f1f1f1;
    cursor: pointer;
    user-select: none;
    border: 2px solid #ccc;
    transition: all 0.15s;
}
.rt-eval-btn:hover { transform: scale(1.05); }
.rt-eval-btn.rt-eval-btn--wide { flex: none; width: 220px; height: 56px; font-size: 1.3rem; }
.rt-eval-btn.color-A { color: #ff6b35; }
.rt-eval-btn.color-B { color: #3a86ff; }
.rt-eval-btn.color-C { color: #b38600; }
.form-check-input:checked + .rt-eval-btn.color-A { background: #ff6b35; color: #fff; border-color: #ff6b35; }
.form-check-input:checked + .rt-eval-btn.color-B { background: #3a86ff; color: #fff; border-color: #3a86ff; }
.form-check-input:checked + .rt-eval-btn.color-C { background: #ffc300; color: #fff; border-color: #ffc300; }

@media (max-width: 768px) {
    .rt-eval-btn-group { gap: 4px; }
}
@media (max-width: 360px) {
    .rt-eval-btn { height: 48px; font-size: 1.25rem; }
}

/* ── 結果ページ：メトリック／めくり表示 ──────────────── */
.rt-result-metric {
    border-radius: 14px;
    padding: 16px 20px;
    color: white;
    text-align: center;
    animation: bounceIn 0.5s ease both;
}
.rt-result-metric .val { font-size: 2.2rem; font-weight: 900; line-height: 1; }
.rt-result-metric .label { font-size: 0.85rem; opacity: 0.9; margin-top: 4px; }
.rt-result-metric.metric-primary { background: linear-gradient(135deg, #e53935, #ff8a3d); }
.rt-result-metric.metric-secondary { background: linear-gradient(135deg, #3a86ff, #6fa8ff); }

.rt-eval-letter { font-size: 2.6rem; font-weight: 900; }
.rt-eval-letter.color-A { color: #ff6b35; }
.rt-eval-letter.color-B { color: #3a86ff; }
.rt-eval-letter.color-C { color: #b38600; }

.rt-reveal-glyph { font-size: 4.2rem; font-weight: 900; line-height: 1; }
.rt-reveal-glyph.is-perfect { color: #3a86ff; }
.rt-reveal-glyph.is-correct { color: #2a9d8f; }
.rt-reveal-glyph.is-close { color: #f4a261; }
.rt-reveal-glyph.is-wrong { color: #e63946; }

/* ── ランキング行 ─────────────────────────────────────── */
.rt-ranking-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.rt-ranking-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 600px;
    padding: 10px 18px;
    border-radius: 14px;
    background: #f8f3ea;
    border: 2px solid #e6ded0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.rt-ranking-row.is-header {
    background: linear-gradient(90deg, #e53935, #ff8a3d);
    color: #fff;
    border: none;
    font-weight: bold;
}
.rt-ranking-row.is-me { border-color: #ff6b35; background: #fff3ee; }
.rt-rank-number {
    font-weight: 900;
    min-width: 2.4rem;
    text-align: center;
    color: #ff6b35;
}
.rt-ranking-row.is-header .rt-rank-number { color: #fff; }
.rt-rank-name { flex: 1; text-align: center; font-weight: 600; padding: 0 8px; }
.rt-rank-name.is-link { cursor: pointer; transition: color 0.2s, text-shadow 0.2s; }
.rt-rank-name.is-link:hover { color: #ff6b35; text-decoration: underline; text-shadow: 0 0 8px rgba(255,107,53,0.25); }
.rt-rank-score { font-weight: 900; color: #2a9d8f; min-width: 5rem; text-align: right; }
.rt-ranking-row.is-header .rt-rank-score { color: #fff; }

/* ── ランキングページャー ─────────────────────────────── */
.rt-ranking-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 12px;
}
.rt-pager-btn {
    border: 2px solid #ffd3c0;
    background: #fff8ec;
    color: #ff6b35;
    border-radius: 999px;
    width: 40px;
    height: 40px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s, opacity 0.2s;
}
.rt-pager-btn:hover:not(:disabled) { border-color: #ff6b35; transform: scale(1.08); }
.rt-pager-btn:disabled { opacity: 0.35; cursor: default; }
.rt-pager-info { font-weight: bold; color: #777; min-width: 4rem; text-align: center; }

/* ── チャート枠 ───────────────────────────────────────── */
.rt-chart-wrap {
    position: relative;
    background: #f8f3ea;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 16px;
}

/* ── 統計テーブル ─────────────────────────────────────── */
.rt-table-wrap {
    background: #f8f3ea;
    border-radius: 14px;
    overflow: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 8px;
}
.rt-table-wrap table { margin-bottom: 0; }
