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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans',
                 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 860px;
    margin: 0 auto;
    background: white;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 36px 40px;
}

h1 {
    text-align: center;
    font-size: 1.6rem;
    color: #1a202c;
    margin-bottom: 28px;
}

/* ── 入力エリア ── */
.input-section {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding: 22px 24px;
    background: #f8f9fa;
    border-radius: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #4a5568;
    letter-spacing: 0.04em;
}

input[type="number"] {
    padding: 10px 12px;
    border: 2px solid #dde1e7;
    border-radius: 8px;
    font-size: 1rem;
    width: 130px;
    background: white;
    color: #1a202c;
    transition: border-color 0.2s, box-shadow 0.2s;
    -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.era-hint {
    font-size: 0.8rem;
    color: #667eea;
    font-weight: 600;
    min-height: 1.2em;
}

select {
    padding: 10px 12px;
    border: 2px solid #dde1e7;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

/* 現在年齢バッジ */
.age-display {
    display: flex;
    align-items: baseline;
    gap: 4px;
    padding: 8px 16px;
    background: #eef2ff;
    border: 1.5px solid #c7d2fe;
    border-radius: 8px;
    align-self: flex-end;
    white-space: nowrap;
}
.age-label, .age-unit { font-size: 0.82rem; color: #4338ca; font-weight: 600; }
.age-value { font-size: 1.5rem; font-weight: 800; color: #3730a3; line-height: 1; }

/* ── 次のお祝いカード ── */
.next-event-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ne-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.75;
}
.ne-name {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.2;
}
.ne-detail {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 2px;
}
.ne-years {
    font-size: 1.15rem;
    font-weight: 700;
    background: rgba(255,255,255,0.22);
    border-radius: 6px;
    padding: 2px 10px;
}
.ne-date { font-size: 0.9rem; opacity: 0.85; }
.ne-age  { font-size: 0.85rem; opacity: 0.7; }

/* ── テーブルヘッダー ── */
.result-section { }
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}
.table-header h2 { font-size: 1.1rem; color: #1a202c; }

.copy-btn {
    padding: 8px 18px;
    background: #38a169;
    color: white;
    border: none;
    border-radius: 7px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.copy-btn:hover { background: #2f855a; }

/* ── テーブル ── */
#tableContainer { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead tr {
    background: #667eea;
    color: white;
}
th {
    padding: 11px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
}

td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; }

/* 行ステータス */
.row-past td { color: #b0b7c3; }
.row-past .ev-name { color: #b0b7c3; }

.row-current {
    background: #fffbeb;
}
.row-current td { color: #92400e; }
.row-current .ev-name { font-weight: 700; color: #78350f; }

.row-future td { color: #2d3748; }
.row-future .ev-name { font-weight: 600; color: #1a202c; }

tbody tr:hover { background: #f7f8ff; }
.row-current:hover { background: #fef3c7; }

/* 今からバッジ */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}
.badge-past    { background: #f1f2f4; color: #9aa0ac; }
.badge-current { background: #fef08a; color: #713f12; border: 1px solid #fde047; }
.badge-future  { background: #e0e7ff; color: #3730a3; }

.ev-era  { color: #667eea; font-size: 0.87rem; }
.ev-west { color: #718096; font-size: 0.87rem; }
.ev-age  { color: #718096; font-size: 0.85rem; }

/* ── レスポンシブ ── */
@media (max-width: 640px) {
    .container { padding: 24px 16px; }
    h1 { font-size: 1.3rem; }
    .input-section { gap: 14px; }
    input[type="number"] { width: 110px; }
    .ne-name { font-size: 1.4rem; }

    /* モバイルでは元号列を非表示 */
    th:nth-child(4), td:nth-child(4) { display: none; }
}
