:root {
    /* 和風モダンパレット */
    --primary-color: #1a1c1d; /* 墨色 (黒) */
    --accent-color: #c9a063; /* 金糸 (マスタードイエロー) */
    --danger-color: #c0392b; /* 朱色 (赤) */
    --bg-color: #f7f5f0; /* 和紙風の生成り色 */
    --text-main: #222222;
    --text-light: #555555;
    
    --glass-bg: rgba(255, 255, 255, 0.90);
    --glass-border: rgba(201, 160, 99, 0.3); /* 金色の薄いボーダー */
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Serif JP', serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
}

/* 和風パターンの背景 */
.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: 
        linear-gradient(45deg, #eaddc4 25%, transparent 25%, transparent 75%, #eaddc4 75%, #eaddc4), 
        linear-gradient(45deg, #eaddc4 25%, transparent 25%, transparent 75%, #eaddc4 75%, #eaddc4);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    z-index: -1;
    opacity: 0.15;
}

.app-container {
    width: 100%;
    max-width: 500px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--primary-color);
    letter-spacing: 2px;
}

.subtitle {
    color: var(--danger-color);
    font-size: 1rem;
    font-weight: bold;
    margin-top: 0.5rem;
}

.header-buttons {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.header-btn {
    border: none;
    padding: 8px 16px;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    font-size: 0.9rem;
    transition: opacity 0.2s;
    display: inline-block;
    text-decoration: none;
}

.header-btn:hover {
    opacity: 0.8;
}

.push-btn { background: var(--primary-color); }
.push-btn.subscribed { background: #6b6b6b; }
.test-btn { background: var(--danger-color); }
.guide-btn { background: var(--accent-color); }

/* ガラスモーフスタイル */
.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

/* パネル上部の和風装飾 */
.glass-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--danger-color), var(--accent-color));
}

.section-title {
    font-size: 1.3rem;
    font-weight: 900;
    margin-bottom: 1.2rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.status-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.refresh-btn {
    flex-shrink: 0;
    border: 1px solid var(--accent-color);
    background: transparent;
    color: var(--primary-color);
    border-radius: 6px;
    padding: 4px 10px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.refresh-btn:hover {
    background: rgba(201, 160, 99, 0.15);
}

.refresh-btn.spinning {
    opacity: 0.6;
    pointer-events: none;
}

/* 状況表示パネル */
.current-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    text-align: center;
}

/* 「現在の土俵：三段目」。枠の外、左寄せの小さいバッジ */
.dohyo-progress {
    display: inline-block;
    align-self: flex-start;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--danger-color);
    background: rgba(192, 57, 43, 0.08);
    border: 1px solid rgba(192, 57, 43, 0.2);
    border-radius: 20px;
    padding: 3px 14px;
}

/* 灰色の枠全体。中に「○/○番」・対戦カード・「次の取組」を縦に並べる */
.dohyo-box {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 1rem 1.2rem 1.3rem;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid #eee;
    border-radius: 8px;
}

/* 「9/38番」。枠内左上に小さく黒字で表示する */
.dohyo-count {
    display: block;
    text-align: left;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.8rem;
}

/* 「次の取組：○○ 対 ○○」。枠内右下に、左上の番号と同じ大きさで表示する */
.dohyo-next {
    display: block;
    text-align: right;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-light);
    margin-top: 1.8rem;
}

/* 対戦カード本体。ここが視線の主役になるよう、力士名を大きく中央に置く */
.dohyo-match {
    display: flex;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    /* 画面幅に応じて自動的に縮小する(iPhone SE/12 mini等の狭い画面で
       4文字以上の名前同士だと2remでは1行に収まらないことがあるため) */
    font-size: clamp(1.4rem, 6.5vw, 2rem);
    font-weight: 900;
    color: var(--primary-color);
}

.dohyo-match .vs {
    font-size: 1rem;
    font-weight: bold;
    color: var(--danger-color);
}

.dohyo-match .loading-text,
.dohyo-match .plain-text {
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-light);
}

/* ABEMA視聴リンク（ステータスパネル内） */
.watch-link {
    display: inline-block;
    align-self: center;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--primary-color);
    background: rgba(201, 160, 99, 0.15);
    border: 1px solid var(--accent-color);
    border-radius: 20px;
    padding: 0.5rem 1.2rem;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.2s;
}

.watch-link:hover {
    background: rgba(201, 160, 99, 0.3);
    transform: translateY(-1px);
}

/* 登録フォーム周辺 */
.filter-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    background: rgba(201, 160, 99, 0.1);
    padding: 10px;
    border-radius: 8px;
}

.control-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: bold;
}

.sumo-select-small {
    padding: 0.5rem;
    font-size: 0.95rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    background-color: white;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notification-timing-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-main);
}

.timing-select {
    width: auto;
    font-weight: bold;
    color: var(--danger-color);
    border-color: var(--accent-color);
}

.sumo-select {
    padding: 1rem;
    font-size: 1.1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: 'Noto Serif JP', serif;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.sumo-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.sumo-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Noto Serif JP', serif;
    font-weight: bold;
    transition: transform 0.2s, background-color 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.sumo-btn:hover {
    background-color: #333;
    transform: translateY(-2px);
}

.sumo-btn:active {
    transform: translateY(0);
}

.outline-btn {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.outline-btn:hover {
    background-color: rgba(0,0,0,0.05);
}


/* モーダル内のABEMA視聴ボタン(aタグをsumo-btnとして表示) */
.watch-btn {
    display: block;
    background-color: var(--accent-color);
    color: var(--primary-color);
    text-decoration: none;
    text-align: center;
    margin-bottom: 0.8rem;
}

.watch-btn:hover {
    background-color: #b8925a;
}

.hidden {
    display: none !important;
}

/* 推し力士登録フォームの注意書き */
.reset-notice {
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.5;
    margin-top: 1rem;
}

/* お気に入り力士リスト */
.list-hint {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: -10px;
    margin-bottom: 15px;
    text-align: right;
}

.oshi-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.empty-msg {
    text-align: center;
    color: var(--text-light);
    font-size: 0.95rem;
    padding: 1rem;
}

.oshi-card {
    background: #fff;
    border-left: 6px solid var(--primary-color);
    border-radius: 6px;
    padding: 1rem 3.5rem 1rem 1.5rem; /* Bug fix: 右パディングを広げて削除ボタンかぶりを解消 */
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s, background-color 0.2s;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.oshi-card:hover {
    transform: translateX(4px);
    background: #fafafa;
}

/* 取組完了状態のカード */
.oshi-card.finished {
    opacity: 0.5;
    border-left-color: #ccc;
    background: #f5f5f5;
}

/* 本日は取組が無い(幕下以下で休みの日)カード */
.oshi-card.resting {
    opacity: 0.65;
    border-left-color: var(--accent-color);
    background: #faf8f3;
}

.oshi-card.alert-active {
    border-left-color: var(--danger-color);
    background: rgba(192, 57, 43, 0.05);
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.2); }
    70% { box-shadow: 0 0 0 6px rgba(192, 57, 43, 0); }
    100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0); }
}

.delete-btn {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.05);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 1.2rem;
    cursor: pointer;
}

.delete-btn:hover {
    color: white;
    background: var(--danger-color);
}

.oshi-card .oshi-name {
    font-size: 1.4rem;
    font-weight: 900;
    margin-bottom: 0.2rem;
    color: var(--primary-color);
    display: flex;
    align-items: baseline;
    gap: 10px;
}

/* 何番目かを示すバッジ */
.match-badge {
    font-size: 0.8rem;
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: normal;
}

.oshi-card .match-details-small {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.8rem;
}

.oshi-card .remaining-matches {
    font-size: 1rem;
    font-weight: bold;
}

.oshi-card .highlight {
    color: var(--danger-color);
    font-size: 1.5rem;
    padding: 0 0.2rem;
}

footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 1rem;
}

/* モーダル (通知ダイアログ) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    padding: 2.5rem;
    text-align: center;
    max-width: 90%;
    width: 400px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    /* Bug fix: glass-effectクラスを使わず専用スタイルで定義 */
    /* glass-effect::before の赤グラデーションがモーダルに出てしまう問題を解消 */
    border-top: 4px solid var(--danger-color);
}

.modal-content .modal-title {
    color: var(--danger-color);
    font-size: 2rem;
    border: none;
    margin-bottom: 1rem;
}

.modal-content .highlight-name {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--primary-color);
}

.modal-content .modal-body {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.modal-content .sub-text {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}
