/* Card layout */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    background: #f5f5f5;
    margin: 0;
    padding: 0;
    color: #111;
}

header {
    position: relative;
    z-index: 101;
}

header nav {
    padding: 1rem 1.5rem;
    background: #fff;
    border-bottom: 2px solid #e0e0e0;
    font-size: 1rem;
}

header nav a {
    text-decoration: none;
    color: #c0392b;
    font-weight: bold;
}

.card-page {
    max-width: 700px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

/* Invite layer */

.invite-layer {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(238, 244, 251, 0.92);
    z-index: 200;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.6s ease;
}

.invite-layer.dimming {
    opacity: 0.4;
}

.invite-layer.gone {
    opacity: 0;
}

.invite-text {
    font-size: 1.8rem;
    font-weight: bold;
    color: #1a4a7a;
    text-align: center;
    padding: 2rem;
    line-height: 1.5;
}

/* Context banner */

@keyframes banner-slide-up {
    from { top: 58px; }
    to   { top: 0px; }
}


.context-banner {
    background: #eef4fb;
    color: #111;
    border: 2px solid #b0cce8;
    border-radius: 10px;
    padding: 1rem 1.4rem;
    text-align: center;
    position: fixed;
    top: 58px;
    left: 0;
    right: 0;
    z-index: 100;
    transition: padding 0.2s ease;
    animation: banner-slide-up linear both;
    animation-timeline: scroll();
    animation-range: 0px 58px;
}

.context-banner.compact {
    padding: 0.5rem 1.4rem;
}

.context-banner.compact .context-banner-trust,
.context-banner.compact .context-banner-en,
.context-banner.compact .context-banner-ja {
    display: none;
}

.context-banner-compact-label {
    display: none;
    font-size: 1rem;
    font-weight: bold;
    color: #1a4a7a;
}

.context-banner.compact .context-banner-compact-label {
    display: block;
}

.context-banner-ja {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.4rem;
    color: #1a4a7a;
}

.context-banner-trust {
    font-size: 0.85rem;
    color: #1a4a7a;
    margin-bottom: 0.4rem;
}

.context-banner-en {
    font-size: 0.9rem;
    color: #555;
}

.clinic-header {
    text-align: center;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.clinic-add-btn {
    background: none;
    border: 1px dashed #ccc;
    border-radius: 20px;
    padding: 0.35rem 1rem;
    font-size: 0.9rem;
    color: #aaa;
    cursor: pointer;
}

.clinic-header input {
    padding: 0.4rem 0.8rem;
    font-size: 1rem;
    border: 2px solid #b0cce8;
    border-radius: 10px;
    outline: none;
    flex: 1;
    max-width: 220px;
}

.clinic-header button#clinic-save {
    padding: 0.4rem 0.8rem;
    background: #1a4a7a;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
}

.clinic-link {
    display: inline-block;
    font-size: 1rem;
    font-weight: bold;
    color: #1a4a7a;
    text-decoration: none;
    background: #eef4fb;
    border: 1px solid #b0cce8;
    border-radius: 20px;
    padding: 0.4rem 1rem;
}

.card-title {
    margin-bottom: 1.5rem;
    text-align: center;
}

.card-title-en {
    display: block;
    font-size: 1.6rem;
    font-weight: bold;
    color: #111;
}

.card-title-ja {
    display: block;
    font-size: 1.4rem;
    color: #555;
    margin-top: 0.3rem;
}

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

.card {
    background: #fff;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.card-highlight {
    border-color: #e0e0e0;
}

.card-section {
    padding: 1.2rem 1.4rem;
}

.card-section.en {
    border-right: 1px solid #e0e0e0;
    background: #fff;
}

.card-section.ja {
    background: #fffaf9;
}

.card-label {
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #888;
    margin-bottom: 0.6rem;
}

.card-highlight .card-label {
    color: #c0392b;
}

.card-doctor .card-label {
    color: #2e7d32;
    font-size: 0.9rem;
}

.card-text {
    font-size: 1.25rem;
    line-height: 1.6;
    color: #111;
}

.tap-item {
    padding: 0.6rem 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.15s;
}

.tap-item.highlighted {
    background: #fff3cd;
    font-weight: bold;
}

@keyframes tap-pulse {
    0%   { background: #fff3cd; }
    25%  { background: #ffe082; }
    50%  { background: #fff3cd; }
    75%  { background: #ffe082; }
    100% { background: #fff3cd; }
}

.tap-item.pulsing {
    animation: tap-pulse 0.83s ease-out;
}

.card-text.editable {
    border-bottom: 1px dashed #ccc;
    outline: none;
    min-height: 1.5em;
}

.card-text.editable:focus {
    border-bottom-color: #c0392b;
    background: #fff8f8;
}

/* Furigana */
rt {
    font-size: 0.55em;
    color: #888;
}

body.hide-furigana rt {
    display: none;
}

.furigana-toggle {
    display: block;
    margin: 0 auto 1.2rem;
    font-size: 0.85rem;
    background: none;
    border: 1px solid #b0cce8;
    border-radius: 20px;
    padding: 0.35rem 1.1rem;
    cursor: pointer;
    color: #1a4a7a;
}

.furigana-toggle.on {
    background: #eef4fb;
}

footer {
    text-align: center;
    padding: 2rem;
    color: #aaa;
    font-size: 0.85rem;
}

@media (max-width: 500px) {
    .card {
        grid-template-columns: 1fr;
    }
    .card-section.en {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    .card-text {
        font-size: 1.15rem;
    }
}
