@charset "UTF-8";

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@400;600&display=swap');

/* ===============================
   Reset
================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 🔥 핵심: html, body를 분리해서 잡음 */
html {
    width: 100%;
    height: 100%;
}

body {
    width: 100%;
    min-height: 100dvh; /* iOS 실제 화면 */

    font-family: 'Noto Serif JP', serif;
    background: #fdfaf7;
    color: #1f2937;

    /* ✅ iOS Safe Area */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);

    /* ❌ 여기서 overflow hidden 금지 */
    overflow-x: hidden;
}

/* ===============================
   Layout
================================ */
.intro-container {
    width: 100%;
    min-height: 100dvh;

    display: flex;
    justify-content: center;
    align-items: center;

    /* ❌ 여기서도 overflow hidden 제거 */
}

/* =================================================
   原稿用紙 本体
   👉 화면 안에 항상 들어오도록 스케일 보정
================================================= */
.manuscript {
    --cell: clamp(2.2em, 5.5vw, 2.6em);
    --rows: 18;
    --cols: 12;

    width: calc(var(--cell) * var(--cols));
    height: calc(var(--cell) * var(--rows));

    max-width: 100%;
    max-height: 100%;

    display: grid;
    grid-template-rows: repeat(var(--rows), var(--cell));
    grid-template-columns: repeat(var(--cols), var(--cell));
    grid-auto-flow: column;
    direction: rtl;

    background-color: #fdfaf7;

    background-image:
        repeating-linear-gradient(
            to left,
            rgba(220, 38, 38, 0.45) 0,
            rgba(220, 38, 38, 0.45) 1px,
            transparent 1px,
            transparent var(--cell)
        ),
        repeating-linear-gradient(
            to bottom,
            rgba(220, 38, 38, 0.35) 0,
            rgba(220, 38, 38, 0.35) 1px,
            transparent 1px,
            transparent var(--cell)
        );

    box-shadow:
        inset 0 0 0.5px rgba(0,0,0,0.15),
        inset 0 0 14px rgba(0,0,0,0.04);
}

/* =================================================
   Cell (공통)
================================================= */
.manuscript .cell {
    width: var(--cell);
    height: var(--cell);

    display: flex;
    align-items: center;
    justify-content: center;

    writing-mode: vertical-rl;
    text-orientation: upright;

    font-size: clamp(14px, 2.4vw, 17px);
    line-height: 1;

    transform: translateY(-0.04em);

    color: #111827;
    text-shadow: 0 0 0.3px rgba(0,0,0,0.35);
}

/* =================================================
   버튼 컬럼
================================================= */
.manuscript .cell.button-cell {
    color: #7f1d1d;
    font-weight: 500;
}

.manuscript .cell.button-cell.clickable:hover {
    background:
        radial-gradient(
            circle at center,
            rgba(120, 30, 30, 0.25),
            transparent 70%
        );
    filter: blur(0.25px);
}

/* =================================================
   🟥 낙관 (常赫印)
================================================= */
.manuscript .cell.seal-cell {
    position: relative;
    z-index: 3;

    transform: translate(-0.18em, 0.22em);

    color: #7a1a12;
    font-weight: 600;

    text-shadow:
        0.6px 0.6px 0 rgba(90, 10, 10, 0.35),
       -0.4px -0.4px 0 rgba(160, 40, 40, 0.25);

    filter: blur(0.15px) saturate(1.15);
}

.manuscript .cell.seal-cell::before {
    content: "";
    position: absolute;
    inset: 0.28em;

    border: 1.4px solid rgba(140, 20, 20, 0.85);
    opacity: 0.85;

    pointer-events: none;
}

.manuscript .cell.seal-cell::after {
    content: "";
    position: absolute;
    inset: -0.1em;

    background:
        radial-gradient(
            circle at 60% 45%,
            rgba(120, 30, 30, 0.18),
            transparent 70%
        );

    mix-blend-mode: multiply;
    pointer-events: none;
}
