.grid {
    width: 90%;
    max-width: 500px;
    aspect-ratio: 1 / 1;
    margin: 50px auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    border: 2px solid #B08833;
    position: relative;
}

.explanation-heading {
    display: block;
    font-size: 1.5em;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 1.5em;
}

.earth {
    color: #7b1e2b;
}

.water {
    color: #d07a28;
}

.air {
    color: #4faa68;
}

.fire {
    color: #c9a24d;
}

.ether {
    color: #1f8a8c;
}

.cell {
    border: 1px solid #B08833;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0.75rem;
}

.corner-title {
    position: absolute;
    font-size: clamp(0.72rem, 1.6vw, 0.95rem);
    font-weight: 600;
}

.top-left .corner-title {
    top: 10px;
    left: 10px;
}

.top-right .corner-title {
    top: 10px;
    right: 10px;
}

.bottom-left .corner-title {
    bottom: 10px;
    left: 10px;
}

.bottom-right .corner-title {
    bottom: 10px;
    right: 10px;
}

.way-title {
    margin-top: 0.4rem;
    font-size: clamp(0.72rem, 1.6vw, 0.95rem);
    font-weight: 600;
}

.number {
    font-size: clamp(1.9rem, 7vw, 3.25rem);
    font-weight: 700;
    line-height: 1;
}

.calc {
    font-size: clamp(0.85rem, 2.7vw, 1.5rem);
    margin-top: 0.35rem;
    opacity: 0.7;
    line-height: 1.2;
}

.center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    border: 2px solid #B08833;
    background: #fffdf6;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #8c7b3b;
    text-align: center;
    padding: 0.4rem;
}

.center::before {
    content: "";
    position: absolute;
    width: 150%;
    height: 150%;
    border-radius: 50%;
    background: repeating-conic-gradient(
        #B08833 0deg 1deg,
        transparent 1deg 10deg
    );
    -webkit-mask: radial-gradient(circle, transparent 50%, black 51%);
    mask: radial-gradient(circle, transparent 50%, black 51%);
    opacity: 0.6;
    z-index: -1;
}

.kkc-wrapper .birth-form,
.kkc-wrapper .grid,
.kkc-wrapper .explain {
    margin-left: auto;
    margin-right: auto;
}

.kkc-wrapper .explain {
    width: 100%;
    max-width: 1000px;
}

.explain {
    display: block;
        grid-template-columns: none;
    gap: 30px;
    width: 90%;
    max-width: 1000px;
    margin: 50px auto;
}

.small {
    font-size: clamp(0.7rem, 2.3vw, 1rem);
}

.chart-heading {
    width: 90%;
    max-width: 500px;
    margin: 30px auto 0;
    text-align: center;
    font-size: clamp(1.4rem, 4vw, 2.1rem);
    color: #5e5330;
}

.kkc-share-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90%;
    max-width: 500px;
    margin: -20px auto 40px;
}

.kkc-share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 160px;
    padding: 11px 20px;
    border: 1px solid #B08833;
    border-radius: 8px;
    background: #B08833;
    color: #fff;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.kkc-share-button:hover:not(:disabled) {
    background: #8c6b24;
}

.kkc-share-button:focus-visible {
    outline: 3px solid rgba(176, 136, 51, 0.35);
    outline-offset: 3px;
}

.kkc-share-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.kkc-share-status {
    min-height: 1.4em;
    margin: 8px 0 0;
    color: #5e5330;
    font-size: 14px;
    text-align: center;
}

.explanation-section {
    background: #fffdf6;
    padding: 25px;
    border: 1px solid #B08833;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}


.reflection {
    margin-top: 15px;
}

@media (min-width: 768px) {
    .explain {
        display: block;
        grid-template-columns: none;
    }
}

.birth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 360px;
    margin: 60px auto;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 18px 40px rgba(94, 83, 48, 0.12);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.birth-form label {
    font-weight: 600;
    font-size: 18px;
}

.birth-form input[type="text"] {
    padding: 10px 12px;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid #ccc;
    width: 100%;
    box-sizing: border-box;
}

.birth-form input[type="text"]:focus {
    outline: none;
    border-color: #B08833;
    box-shadow: 0 0 0 3px rgba(200,185,126,0.2);
}

.birth-form button:not(.picker-arrow) {
    padding: 10px;
    font-size: 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background: #B08833;
    color: white;
    transition: 0.2s ease;
}
/* 
.birth-form button:not(.picker-arrow):hover:not(:disabled) {
    background: #b6a66f;
} */

.birth-form button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    background: #B08833;
}

.button-group {
    display: flex;
    gap: 10px;
}

.button-group button {
    flex: 1;
}

.reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    font-size: 16px;
    border-radius: 8px;
    text-decoration: none;
    border: 1px solid #ccc;
    color: #333;
    background: #f3f3f3;
    transition: 0.2s ease;
}

.reset-btn:hover {
    background: #e0e0e0;
}

.ios-picker-container {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 10px;
    position: relative;
    height: 260px;
    padding: 12px;
    background: #f0f0f5;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
}

.picker-column {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.picker-arrow {
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #B08833;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(94, 83, 48, 0.28);
    transition: opacity 0.2s ease, transform 0.2s ease;
    touch-action: manipulation;
}

.picker-arrow:hover {
    color: rgba(255, 255, 255, 0.95);
    opacity: 0.75;
}

.picker-arrow:active {
    transform: scale(0.97);
}

.picker-arrow:focus-visible {
    outline: 2px solid rgba(200, 185, 126, 0.7);
    outline-offset: 2px;
}

.picker-wheel-shell {
    position: relative;
    flex: 1;
    overflow: hidden;
    border-radius: 12px;
}

.picker-wheel-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background: linear-gradient(
        to bottom,
        rgba(240, 240, 245, 0.92) 0%,
        rgba(240, 240, 245, 0.45) 18%,
        rgba(240, 240, 245, 0) 34%,
        rgba(240, 240, 245, 0) 66%,
        rgba(240, 240, 245, 0.45) 82%,
        rgba(240, 240, 245, 0.92) 100%
    );
}

.picker-wheel {
    flex: 1;
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    overscroll-behavior: contain;
}

.picker-wheel::-webkit-scrollbar { display: none; }

.picker-wheel div {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    font-size: 18px;
    color: #333;
    transition: transform 0.2s;
}

.picker-selection-highlight {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 40px;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.05);
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    pointer-events: none;
    border-radius: 5px;
    z-index: 1;
}

@media (max-width: 480px) {
    .grid {
        width: 95%;
    }

    .cell {
        padding: 0.45rem;
    }

    .center {
        width: 34%;
    }

    .corner-title {
        max-width: 42%;
    }
}

.kkc-wrapper {
    width: 100%;
    max-width: 1000px;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

.kkc-error {
    max-width: 500px;
    margin: 20px auto;
    padding: 12px 16px;
    border: 1px solid #B08833;
    border-radius: 8px;
    background: #fffdf6;
    color: #7b1e2b;
}

.kkc-wrapper .ios-picker-container {
    width: 100%;
    box-sizing: border-box;
    gap: 6px;
}

.kkc-wrapper .picker-column {
    flex: 1 1 0;
    min-width: 0;
}

.kkc-wrapper .picker-wheel div {
    font-size: clamp(13px, 3.2vw, 18px);
    padding: 0 2px;
    box-sizing: border-box;
    white-space: nowrap;
}

.kkc-wrapper .birth-form button[type="submit"]:disabled {
    pointer-events: none;
}
