:root {
    --bg-color: #F8FBFF; /* Soft very pale blue background */
    --primary-color: #89B4FA; /* Soft pale blue */
    --primary-hover: #74A5F9;
    --secondary-color: #E5EDFB;
    --text-color: #4A5A75; /* Slate blue text */
    --shadow-light: rgba(137, 180, 250, 0.15);
    --shadow-medium: rgba(137, 180, 250, 0.25);
    
    /* Break Mode variables (Soft Mint/Teal) */
    --break-bg-color: #F6FCFA;
    --break-primary-color: #79CBB8;
    --break-primary-hover: #5DBFA7;
    --break-secondary-color: #E2F5F0;
    --break-shadow-light: rgba(121, 203, 184, 0.15);
    --break-shadow-medium: rgba(121, 203, 184, 0.25);

    --white: #FFFFFF;
}

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

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-y: auto; /* Changed to allow scrolling if ads make it taller */
    padding: 2rem 0; /* Add padding for scroll breathing room */
    transition: background-color 0.8s ease;
}

/* Break Mode Overrides via CSS Variables */
body.break-mode {
    --bg-color: var(--break-bg-color);
    --primary-color: var(--break-primary-color);
    --primary-hover: var(--break-primary-hover);
    --secondary-color: var(--break-secondary-color);
    --shadow-light: var(--break-shadow-light);
    --shadow-medium: var(--break-shadow-medium);
}

.app-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem; /* Space between ads and timer */
    width: 100%;
}

/* Ad Space Styling (Placeholder) */
.ad-space {
    width: 100%; /* カードの内側いっぱい(380pxだと枠からはみ出す) */
    height: 90px; /* Original height */
    background-color: rgba(0, 0, 0, 0.03);
    border: 1px dashed rgba(74, 90, 117, 0.2);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-text {
    color: var(--text-color);
    font-size: 0.8rem;
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ad-sale {
    margin-top: 2rem;
}

a.ad-space {
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

a.ad-space:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-color: rgba(74, 90, 117, 0.4);
}

.ad-sale-2 {
    margin-top: 0.75rem;
}

/* 掲載中のスポンサーバナー(1.91:1)。制作者ロゴの直上に置く */
.sponsor-banner {
    display: block;
    width: 100%;
    margin-top: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    background: #1d2d3d;
    border: 1px solid #16222e;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sponsor-banner img {
    display: block;
    width: 100%;
    height: auto;
}

.sponsor-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(29, 45, 61, 0.18);
}

/* 制作者表記(produced by + ロゴ)。ロゴは枠幅に収まる大きさに抑える */
.company-credit {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.credit-text {
    font-size: 0.75rem;
    opacity: 0.6;
    letter-spacing: 0.5px;
}

.ad-bottom-actual a {
    display: block;
}

.company-logo-img {
    display: block;
    width: 180px;
    max-width: 100%;
    height: auto;
}

.timer-container {
    background: var(--white);
    padding: 3rem; /* 3remに戻す */
    border-radius: 32px;
    box-shadow: 0 20px 50px var(--shadow-light), 0 10px 20px rgba(0,0,0,0.03);
    text-align: center;
    width: 380px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: box-shadow 0.3s ease;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2rem;
    letter-spacing: 1px;
}

.timer-mode {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    background-color: var(--secondary-color);
    padding: 0.2rem 1.2rem;
    border-radius: 20px;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.8;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.timer-display {
    position: relative;
    width: 280px;
    height: 280px;
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.progress-ring {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotate(-90deg); /* Start rendering from top */
}

.progress-ring__circle {
    transition: stroke-dashoffset 0.1s linear;
}

.time-input-container {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.time-input {
    width: 80px;
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-color);
    background: transparent;
    border: none;
    text-align: center;
    outline: none;
    font-family: 'Nunito', sans-serif;
    transition: color 0.3s ease, transform 0.2s ease;
}

/* Hide up/down arrows for number inputs */
.time-input::-webkit-outer-spin-button,
.time-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.time-input[type=number] {
    -moz-appearance: textfield;
}

.time-input:focus {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    transform: scale(1.05);
}

.time-input:disabled {
    color: var(--text-color);
    border-bottom: none;
    transform: none;
}

.colon {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 4px;
    padding-bottom: 8px; /* Optical alignment adjustment */
}

.controls {
    display: flex;
    gap: 1rem;
    width: 100%;
    justify-content: center;
}

.btn {
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    outline: none;
}

.btn:active {
    transform: scale(0.95);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    box-shadow: 0 8px 20px var(--shadow-medium);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    box-shadow: 0 10px 25px var(--shadow-medium);
    transform: translateY(-2px);
}

.btn-secondary, .btn-tertiary {
    background-color: var(--secondary-color);
    color: var(--primary-hover);
}

.btn-secondary:hover:not(:disabled), .btn-tertiary:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
}

/* Social Share Buttons */
.social-share {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(137, 180, 250, 0.2);
    width: 100%;
    justify-content: center;
}

.btn-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Nunito', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    background-color: transparent;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    transform: translateY(-2px);
}

.btn-x {
    color: var(--text-color);
    background-color: rgba(15, 20, 25, 0.05); /* Very light grey */
}
.btn-x:hover {
    background-color: rgba(15, 20, 25, 0.1);
    color: #0F1419;
}

.btn-fb {
    color: var(--text-color);
    background-color: rgba(24, 119, 242, 0.05); /* Very light facebook blue */
}
.btn-fb:hover {
    background-color: rgba(24, 119, 242, 0.1);
    color: #1877F2;
}

/* Animation for when the timer finishes */
@keyframes pulseGlow {
    0% { transform: scale(1); box-shadow: 0 20px 50px var(--shadow-light); }
    50% { transform: scale(1.02); box-shadow: 0 20px 60px rgba(137, 180, 250, 0.4); }
    100% { transform: scale(1); box-shadow: 0 20px 50px var(--shadow-light); }
}

.timer-finished {
    animation: pulseGlow 3s ease-in-out infinite;
}

.timer-finished .progress-ring__circle {
    stroke: var(--primary-hover);
}

/* 使い方とよくある質問（検索で見つけた人にも何のページか伝わるように） */
.about { width: 380px; max-width: 90vw; background: var(--white); border-radius: 24px; padding: 1.6rem 1.5rem; box-shadow: 0 10px 30px var(--shadow-light); line-height: 1.75; font-size: 0.95rem; }
.about h2 { font-size: 1.05rem; margin: 0 0 0.6rem; }
.about h2:not(:first-child) { margin-top: 1.4rem; }
.about ol { padding-left: 1.3rem; display: grid; gap: 0.35rem; }
.about details { border-top: 1px solid var(--secondary-color); padding: 0.55rem 0; }
.about summary { cursor: pointer; font-weight: 700; }
.about details p { margin-top: 0.35rem; }
.about-more { margin-top: 1.2rem; font-size: 0.88rem; }
.about a { color: inherit; font-weight: 700; }

/* 使い方・ホーム画面への入れ方へのリンク */
.help-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; margin-top: 1.2rem; font-size: 0.85rem; }
.help-links a { color: var(--text-color); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.help-links a:hover { opacity: 0.72; }

/* スマホ: 枠を画面幅に合わせ、円と数字を縮める(280pxの円が枠からはみ出していた) */
@media (max-width: 480px) {
    body { padding: calc(1rem + env(safe-area-inset-top)) 0 calc(1.5rem + env(safe-area-inset-bottom)); align-items: flex-start; }
    .app-layout { gap: 1.25rem; }
    .timer-container { width: calc(100vw - 32px); max-width: none; padding: 1.75rem 1.1rem; border-radius: 26px; }
    .timer-display { width: 240px; height: 240px; }
    .progress-ring { width: 240px; height: 240px; }
    .time-input { width: 68px; font-size: 3.4rem; }
    .about { width: calc(100vw - 32px); max-width: none; }
}

/* ホーム画面から開いたとき(アプリとして起動): ブラウザの余白をなくし、アプリらしく */
@media (display-mode: standalone) {
    html, body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
    body { -webkit-tap-highlight-color: transparent; }
    .social-share { display: none; }
    .install-hint { display: none; }
}
