
/* WEBテトリス - Final Edition UI refresh */
#outputBlock,
#outputBlock * { box-sizing: border-box; }
#outputBlock .resultHeader {
    background: linear-gradient(135deg, #111827 0%, #1d2540 48%, #0f766e 100%);
    color: #fff;
    border-radius: 20px 20px 0 0;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 15px 18px;
}
#outputBlock .resultBody {
    overflow: hidden;
    padding: 20px;
    background:
        radial-gradient(circle at 8% 0%, rgba(57, 213, 255, 0.16), transparent 30%),
        radial-gradient(circle at 100% 20%, rgba(199, 108, 255, 0.14), transparent 30%),
        linear-gradient(180deg, #f7f9fc 0%, #eef2f8 100%);
    border: 1px solid #dfe5f0;
    border-top: 0;
    border-radius: 0 0 20px 20px;
}
#tetrisShell { max-width: 860px; margin: 0 auto; }
#tetrisShell .tetrisLead { margin-bottom: 14px; color: #273142; }
#tetrisShell .tetrisLead strong { display: inline-block; margin-bottom: 6px; font-size: 18px; color: #111827; }
#tetrisShell .tetrisBadges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
#tetrisShell .tetrisBadge {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
    background: #e9eefc; color: #324a8a; font-size: 12px; font-weight: 800;
}
#inputBlock { margin-bottom: 16px; }
#inputBlock .textareaTable.tetrisSettingTable {
    width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid #dbe3f1;
    border-radius: 16px; overflow: hidden; box-shadow: 0 6px 24px rgba(18, 28, 45, 0.06);
}
#inputBlock .tetrisSettingTable th,
#inputBlock .tetrisSettingTable td { padding: 12px 14px; vertical-align: middle; border-top: 1px solid #edf2fa; }
#inputBlock .tetrisSettingTable tr:first-child th { border-top: 0; background: linear-gradient(135deg, #14966d, #2858c7); color: #fff; }
#inputBlock .tetrisSettingTable tr:first-child h3 { margin: 0; color: #fff; font-size: 16px; }
#inputBlock .tetrisSettingTable th { width: 140px; text-align: left; color: #354052; font-weight: 800; background: #fbfcff; }
#inputBlock .inputSelect {
    width: 100%; max-width: 360px; min-height: 44px; border: 1px solid #cad6eb; border-radius: 12px; padding: 0 12px;
    font-size: 15px; background: #fff;
}
#inputBlock .tetrisOptionRow, #inputBlock .tetrisActionRow {
    display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center;
}
#inputBlock .tetrisCheck { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; cursor: pointer; }
#inputBlock .tetrisCheck input { transform: scale(1.15); }
#inputBlock .tetrisActionRow .btn_form {
    min-width: 140px; min-height: 42px; border-radius: 12px; font-weight: 800;
}
#inputBlock .tetrisActionRow .btn_secondary { background: #fff; color: #23324d; border: 1px solid #ccd7eb; }
#tetrisShell .tetrisTopStats {
    display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 10px; margin-bottom: 16px;
}
#tetrisShell .tetrisTopStat {
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(245,248,255,0.98) 100%);
    border: 1px solid #d9e3f5; border-radius: 16px; padding: 12px 10px; text-align: center;
    box-shadow: 0 10px 24px rgba(16, 34, 73, 0.08);
}
#tetrisShell .tetrisTopStatLabel { font-size: 12px; color: #6b778c; margin-bottom: 6px; font-weight: 800; }
#tetrisShell .tetrisTopStatValue { font-size: 25px; font-weight: 900; line-height: 1.2; color: #18253d; }
#tetrisShell .tetrisTopStatValue.sub { font-size: 18px; color: #2858c7; }
#tetrisShell .tetrisTopStatValue.best { color: #0f766e; }
#tetrisApp.tetrisApp {
    display: grid !important; grid-template-columns: minmax(0, 320px) minmax(0, 220px); gap: 18px;
    align-items: start; justify-content: center; width: 100%; max-width: 600px; margin: 0 auto;
}
#tetrisApp .tetrisMain { position: relative; width: 320px; min-width: 320px; transition: transform 120ms ease; }
#tetrisApp .tetrisMain.is-shake { animation: tetrisShake 160ms ease-in-out; }
@keyframes tetrisShake { 0% { transform: translateX(0); } 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } 100% { transform: translateX(0); } }
#tetrisCanvas {
    display: block; width: 320px !important; height: 640px !important; background: #0b1020; border: 1px solid #1e2a4a;
    border-radius: 18px; box-shadow: 0 20px 44px rgba(10, 18, 40, 0.26);
}
#tetrisApp .tetrisOverlay {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: linear-gradient(180deg, rgba(7, 11, 24, 0.60) 0%, rgba(7, 11, 24, 0.88) 100%);
    color: #fff; text-align: center; padding: 24px; border-radius: 18px; z-index: 4;
}
#tetrisApp .overlayTitle { font-size: 34px; font-weight: 900; letter-spacing: 0.05em; margin-bottom: 12px; text-shadow: 0 4px 12px rgba(0,0,0,0.25); }
#tetrisApp .overlayText { font-size: 14px; line-height: 1.8; max-width: 240px; white-space: pre-line; }
#tetrisApp .tetrisFloatingText {
    position: absolute; left: 50%; top: 42%; z-index: 3; transform: translate(-50%, -50%); min-width: 180px; pointer-events: none;
    text-align: center; color: #fff; font-weight: 900; letter-spacing: 0.08em;
    text-shadow: 0 4px 20px rgba(0,0,0,0.5), 0 0 18px rgba(57,213,255,0.9); opacity: 0;
}
#tetrisApp .tetrisFloatingText.is-show { animation: tetrisPop 780ms ease-out; }
@keyframes tetrisPop {
    0% { opacity: 0; transform: translate(-50%, -42%) scale(0.86); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
    70% { opacity: 1; transform: translate(-50%, -62%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -76%) scale(0.96); }
}
#tetrisApp .floatingMain { display: block; font-size: 28px; }
#tetrisApp .floatingSub { display: block; margin-top: 4px; font-size: 13px; color: #9eefff; }
#tetrisApp .tetrisSide { width: 220px; min-width: 220px; display: grid; gap: 10px; }
#tetrisApp .tetrisPanel {
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(245,248,255,0.98) 100%);
    border: 1px solid #d9e3f5; border-radius: 16px; padding: 12px; text-align: center;
    box-shadow: 0 10px 24px rgba(16, 34, 73, 0.08);
}
#tetrisApp .tetrisLabel { font-size: 12px; color: #6b778c; margin-bottom: 6px; font-weight: 800; }
#holdCanvas, #nextCanvas {
    display: block; width: 100% !important; max-width: 100%; background: linear-gradient(180deg, #0c1326 0%, #0a1020 100%);
    border-radius: 13px; border: 1px solid #1a284a; margin: 0 auto;
}
#holdCanvas { height: auto; }
#tetrisApp .resultBox {
    display: none; margin-top: 0; padding: 12px; border-radius: 14px; background: #111827; color: #fff; text-align: left;
}
#tetrisApp .resultBox.is-show { display: block; }
#tetrisApp .resultBoxTitle { font-weight: 900; margin-bottom: 8px; }
#tetrisApp .resultBox p { margin: 4px 0; font-size: 13px; line-height: 1.6; }
#tetrisApp .shareText {
    width: 100%; min-height: 62px; margin-top: 8px; padding: 8px; border-radius: 10px; border: 1px solid #405071;
    background: #0b1020; color: #fff; font-size: 12px; resize: vertical;
}
#tetrisApp #copyShare { width: 100%; margin-top: 8px; min-height: 42px; border-radius: 12px; }
.touchControls {
    display: none; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; max-width: 600px; margin: 16px auto 0;
}
.touchControls button {
    min-height: 48px; border: 1px solid #cad6eb; border-radius: 12px; background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
    color: #1f2e4a; font-size: 15px; font-weight: 800; cursor: pointer; box-shadow: 0 8px 20px rgba(18, 28, 45, 0.08);
}
.tetrisGuide {
    max-width: 860px; margin: 18px auto 0; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px;
}
.tetrisGuideCard {
    background: #fff; border: 1px solid #dce4f3; border-radius: 16px; padding: 16px; box-shadow: 0 8px 24px rgba(18, 28, 45, 0.06);
}
.tetrisGuideCard h3 { margin: 0 0 10px; font-size: 16px; color: #1b2740; }
.tetrisGuideList { list-style: none; margin: 0; padding: 0; }
.tetrisGuideList li {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid #edf2fa;
    font-size: 13px; color: #3e4a5f;
}
.tetrisGuideList li:first-child { border-top: 0; padding-top: 0; }
.tetrisGuideKey { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.tetrisGuideKey kbd {
    min-width: 30px; padding: 6px 8px; border-radius: 8px; border: 1px solid #ccd7eb; background: #f7faff;
    box-shadow: inset 0 -2px 0 rgba(120, 144, 180, 0.15); color: #20304f; font-size: 12px; font-family: inherit; text-align: center;
}
.tetrisTips { margin-top: 14px; padding: 14px 16px; background: #1d2540; color: #fff; border-radius: 14px; font-size: 13px; line-height: 1.8; }
.tetrisTips strong { color: #8be7c9; }
@media screen and (max-width: 767px) {
    #outputBlock .resultBody { padding: 14px; }
    #tetrisShell .tetrisLead strong { font-size: 16px; }
    #inputBlock .tetrisSettingTable th, #inputBlock .tetrisSettingTable td { display: block; width: 100%; }
    #inputBlock .tetrisOptionRow, #inputBlock .tetrisActionRow { display: grid; grid-template-columns: 1fr; gap: 10px; }
    #inputBlock .tetrisActionRow .btn_form { width: 100%; }
    #tetrisShell .tetrisTopStats { grid-template-columns: repeat(2, minmax(0,1fr)); }
    #tetrisApp.tetrisApp { grid-template-columns: 1fr; max-width: 320px; }
    #tetrisApp .tetrisMain, #tetrisApp .tetrisSide { width: 100%; min-width: 0; }
    #tetrisCanvas { width: min(92vw, 320px) !important; height: calc(min(92vw, 320px) * 2) !important; }
    #tetrisApp .overlayTitle { font-size: 28px; }
    .touchControls { display: grid; }
    .tetrisGuide { grid-template-columns: 1fr; }
}


/* Feature pack: daily challenge, analysis, mission, themes */
#tetrisShell[data-theme="neon"] {
    --accent: #2858c7;
    --accent2: #0f766e;
    --panel-bg: rgba(255,255,255,0.98);
}
#tetrisShell[data-theme="wood"] {
    --accent: #8b5a2b;
    --accent2: #b45309;
    --panel-bg: #fff7ed;
}
#tetrisShell[data-theme="crystal"] {
    --accent: #7c3aed;
    --accent2: #0891b2;
    --panel-bg: rgba(250,245,255,0.98);
}
#tetrisShell[data-theme="mono"] {
    --accent: #334155;
    --accent2: #111827;
    --panel-bg: #f8fafc;
}
#tetrisShell[data-theme="pastel"] {
    --accent: #db2777;
    --accent2: #0d9488;
    --panel-bg: #fff1f7;
}
#tetrisShell .tetrisMissionBar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid #dce4f3;
    background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(238,244,255,0.96));
    box-shadow: 0 8px 24px rgba(18, 28, 45, 0.06);
}
#tetrisShell .tetrisMissionTitle {
    font-size: 12px;
    font-weight: 900;
    color: #6b778c;
    margin-bottom: 4px;
}
#tetrisShell .tetrisMissionText {
    font-size: 15px;
    font-weight: 900;
    color: #1b2740;
}
#tetrisShell .tetrisMissionMeta {
    font-size: 12px;
    color: #526078;
    margin-top: 4px;
}
#tetrisShell .tetrisMissionStatus {
    min-width: 92px;
    text-align: center;
    padding: 8px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #2858c7;
    font-size: 12px;
    font-weight: 900;
}
#tetrisShell .tetrisMissionStatus.is-clear {
    background: #dcfce7;
    color: #047857;
}
#inputBlock .inputSelect.themeSelect {
    max-width: 260px;
}
#tetrisApp .analysisBox {
    margin-top: 10px;
    padding: 12px;
    border-radius: 14px;
    background: #f8fbff;
    border: 1px solid #dce4f3;
    color: #273142;
}
#tetrisApp .analysisBoxTitle {
    font-size: 13px;
    font-weight: 900;
    margin-bottom: 6px;
    color: #111827;
}
#tetrisApp .analysisBox p {
    margin: 5px 0;
    font-size: 12px;
    line-height: 1.65;
}
#tetrisApp .analysisTags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
#tetrisApp .analysisTag {
    padding: 5px 7px;
    border-radius: 999px;
    background: #e9eefc;
    color: #324a8a;
    font-size: 11px;
    font-weight: 800;
}
#tetrisShell[data-theme="wood"] .tetrisTopStat,
#tetrisShell[data-theme="wood"] .tetrisPanel,
#tetrisShell[data-theme="wood"] .tetrisGuideCard,
#tetrisShell[data-theme="wood"] .tetrisMissionBar {
    background: linear-gradient(180deg, #fff7ed 0%, #fffbeb 100%);
    border-color: #fed7aa;
}
#tetrisShell[data-theme="wood"] .tetrisBadge,
#tetrisShell[data-theme="wood"] .analysisTag {
    background: #ffedd5;
    color: #9a3412;
}
#tetrisShell[data-theme="crystal"] .tetrisTopStat,
#tetrisShell[data-theme="crystal"] .tetrisPanel,
#tetrisShell[data-theme="crystal"] .tetrisGuideCard,
#tetrisShell[data-theme="crystal"] .tetrisMissionBar {
    background: linear-gradient(180deg, #faf5ff 0%, #ecfeff 100%);
    border-color: #ddd6fe;
}
#tetrisShell[data-theme="crystal"] .tetrisBadge,
#tetrisShell[data-theme="crystal"] .analysisTag {
    background: #ede9fe;
    color: #5b21b6;
}
#tetrisShell[data-theme="mono"] .tetrisTopStat,
#tetrisShell[data-theme="mono"] .tetrisPanel,
#tetrisShell[data-theme="mono"] .tetrisGuideCard,
#tetrisShell[data-theme="mono"] .tetrisMissionBar {
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    border-color: #cbd5e1;
}
#tetrisShell[data-theme="mono"] .tetrisBadge,
#tetrisShell[data-theme="mono"] .analysisTag {
    background: #e2e8f0;
    color: #1f2937;
}
#tetrisShell[data-theme="pastel"] .tetrisTopStat,
#tetrisShell[data-theme="pastel"] .tetrisPanel,
#tetrisShell[data-theme="pastel"] .tetrisGuideCard,
#tetrisShell[data-theme="pastel"] .tetrisMissionBar {
    background: linear-gradient(180deg, #fff1f7 0%, #f0fdfa 100%);
    border-color: #fbcfe8;
}
#tetrisShell[data-theme="pastel"] .tetrisBadge,
#tetrisShell[data-theme="pastel"] .analysisTag {
    background: #fce7f3;
    color: #9d174d;
}
@media screen and (max-width: 767px) {
    #tetrisShell .tetrisMissionBar {
        grid-template-columns: 1fr;
    }
    #tetrisShell .tetrisMissionStatus {
        width: 100%;
    }
}


/* UI simplification by request */
#outputBlock .resultHeader { display: none; }
#tetrisShell .tetrisLead { display: none; }
#tetrisShell .tetrisMissionBar { margin-top: 0; }
#tetrisShell .tetrisMissionTitle { margin-bottom: 2px; }
#tetrisShell .tetrisMissionMeta { display: none; }
#tetrisShell .tetrisTopStats { margin-top: 0; }
#tetrisShell .tetrisGuide { grid-template-columns: 1fr; max-width: 600px; }
#tetrisShell[data-theme="wood"] .tetrisTopStat,
#tetrisShell[data-theme="wood"] .tetrisPanel,
#tetrisShell[data-theme="wood"] .tetrisGuideCard,
#tetrisShell[data-theme="wood"] .tetrisMissionBar {
    background: linear-gradient(180deg, #fff7ed 0%, #fffbeb 100%);
    border-color: #fed7aa;
}
#tetrisShell[data-theme="wood"] .tetrisBadge,
#tetrisShell[data-theme="wood"] .analysisTag {
    background: #ffedd5;
    color: #9a3412;
}

/* Compact stats and controls under board */
#tetrisShell .tetrisTopStats {
    grid-template-columns: repeat(5, minmax(0,1fr));
    gap: 8px;
    margin-bottom: 12px;
}
#tetrisShell .tetrisTopStat {
    padding: 8px 6px;
    border-radius: 12px;
}
#tetrisShell .tetrisTopStatLabel {
    font-size: 11px;
    margin-bottom: 4px;
}
#tetrisShell .tetrisTopStatValue { font-size: 20px; }
#tetrisShell .tetrisTopStatValue.sub { font-size: 15px; }
#tetrisApp.tetrisApp {
    grid-template-columns: minmax(0, 320px) minmax(0, 200px);
    max-width: 540px;
    gap: 14px;
}
#tetrisApp .tetrisSide { width: 200px; min-width: 200px; gap: 8px; }
#tetrisApp .tetrisPanel { padding: 10px; }
#tetrisApp .tetrisUnderControls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 8px;
    margin-top: 10px;
}
#tetrisApp .tetrisUnderControls .btn_form {
    min-height: 42px;
    border-radius: 12px;
    font-weight: 800;
    width: 100%;
}
#tetrisApp .tetrisUnderControls .btn_secondary {
    background: #fff;
    color: #23324d;
    border: 1px solid #ccd7eb;
}
#inputBlock .tetrisActionRow { display:none; }
#inputBlock .tetrisSettingTable th:first-child { width: 110px; }
@media screen and (max-width: 767px) {
    #tetrisShell .tetrisTopStats { grid-template-columns: repeat(3, minmax(0,1fr)); }
    #tetrisApp .tetrisUnderControls { grid-template-columns: 1fr; }
}


/* Click fix: keep overlay limited to the board only */
#tetrisApp .tetrisBoardWrap {
    position: relative;
    width: 320px;
    height: 640px;
}
#tetrisApp .tetrisBoardWrap .tetrisOverlay {
    inset: 0;
}
#tetrisApp .tetrisUnderControls {
    position: relative;
    z-index: 20;
    pointer-events: auto;
}
#tetrisApp .tetrisUnderControls button {
    pointer-events: auto;
}
@media screen and (max-width: 767px) {
    #tetrisApp .tetrisBoardWrap {
        width: min(92vw, 320px);
        height: calc(min(92vw, 320px) * 2);
    }
}

/* improved controls */
#tetrisApp .tetrisUnderControls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 12px;
}
#tetrisApp .tetrisUnderControls .btn_form {
    min-height: 46px;
    border-radius: 14px;
    font-weight: 800;
    width: 100%;
    box-shadow: 0 8px 20px rgba(18, 28, 45, 0.10);
}
#tetrisApp .tetrisUnderControls .btn_primaryAction {
    min-height: 52px;
    font-size: 18px;
    letter-spacing: 0.04em;
    background: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
    border: 0;
    color: #fff;
}
#tetrisApp .tetrisControlSubRow {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
#tetrisApp .tetrisUnderControls .btn_control {
    background: #fff;
    color: #23324d;
    border: 1px solid #ccd7eb;
    font-size: 14px;
    line-height: 1.3;
    padding: 8px 10px;
}
#tetrisApp .tetrisUnderControls .btn_pause {
    background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
}
#tetrisApp .tetrisUnderControls .btn_stop {
    background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
    border-color: #fdba74;
    color: #9a3412;
}
#tetrisApp .tetrisUnderControls .btn_reset {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
#tetrisApp .tetrisUnderControls .btn_control.is-active {
    background: linear-gradient(180deg, #e0f2fe 0%, #dbeafe 100%);
    border-color: #60a5fa;
    color: #1d4ed8;
}
#tetrisApp .tetrisUnderControls .btn_form:hover {
    transform: translateY(-1px);
}
#tetrisApp .tetrisUnderControls .btn_form:active {
    transform: translateY(0);
}
@media screen and (max-width: 767px) {
    #tetrisApp .tetrisControlSubRow {
        grid-template-columns: 1fr;
    }
}


/* Switch UI and custom mode settings */
#inputBlock .tetrisOptionRow {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    align-items: center;
}
#inputBlock .tetrisSwitch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 800;
    color: #26344f;
    user-select: none;
}
#inputBlock .tetrisSwitch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
#inputBlock .tetrisSlider {
    position: relative;
    width: 46px;
    height: 24px;
    border-radius: 999px;
    background: #cbd5e1;
    border: 1px solid #b6c2d4;
    transition: background 0.18s ease, border-color 0.18s ease;
    flex: 0 0 auto;
}
#inputBlock .tetrisSlider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    top: 2px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
    transition: transform 0.18s ease;
}
#inputBlock .tetrisSwitch input:checked + .tetrisSlider {
    background: linear-gradient(135deg, #10b981 0%, #2563eb 100%);
    border-color: #10b981;
}
#inputBlock .tetrisSwitch input:checked + .tetrisSlider::before {
    transform: translateX(22px);
}
#inputBlock .tetrisSwitchText {
    min-width: 52px;
}
#inputBlock .tetrisCustomRow {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
}
#inputBlock .tetrisCustomRow label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    color: #26344f;
}
#inputBlock .inputSelect.smallSelect {
    width: 140px;
    max-width: 140px;
    min-height: 38px;
    border-radius: 10px;
}
#inputBlock .tetrisSettingNote {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.6;
    color: #64748b;
}
@media screen and (max-width: 767px) {
    #inputBlock .tetrisOptionRow,
    #inputBlock .tetrisCustomRow {
        display: grid;
        grid-template-columns: 1fr;
    }
    #inputBlock .inputSelect.smallSelect {
        width: 100%;
        max-width: none;
    }
}

/* custom setting note fix */
#inputBlock .tetrisSettingNote {
    color: #475569;
    font-weight: 700;
}


/* compact settings and controls guide */
#inputBlock { margin-bottom: 12px; }
#inputBlock .textareaTable.tetrisSettingTable {
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(18,28,45,0.05);
}
#inputBlock .tetrisSettingTable th,
#inputBlock .tetrisSettingTable td {
    padding: 8px 10px;
    font-size: 13px;
}
#inputBlock .tetrisSettingTable tr:first-child th {
    padding: 9px 12px;
}
#inputBlock .tetrisSettingTable tr:first-child h3 {
    font-size: 14px;
}
#inputBlock .tetrisSettingTable th {
    width: 98px;
    font-size: 12px;
}
#inputBlock .inputSelect {
    min-height: 38px;
    max-width: 320px;
    border-radius: 10px;
    font-size: 13px;
    padding: 0 10px;
}
#inputBlock .inputSelect.smallSelect {
    width: 124px;
    max-width: 124px;
    min-height: 34px;
    font-size: 12px;
}
#inputBlock .themeSelect {
    max-width: 180px;
}
#inputBlock .tetrisOptionRow,
#inputBlock .tetrisCustomRow {
    gap: 8px 12px;
}
#inputBlock .tetrisSwitch {
    gap: 6px;
    font-size: 12px;
}
#inputBlock .tetrisSlider {
    width: 40px;
    height: 22px;
}
#inputBlock .tetrisSlider::before {
    width: 16px;
    height: 16px;
}
#inputBlock .tetrisSwitch input:checked + .tetrisSlider::before {
    transform: translateX(18px);
}
#inputBlock .tetrisSwitchText {
    min-width: 46px;
}
#inputBlock .tetrisCustomRow label {
    gap: 6px;
    font-size: 12px;
}
#inputBlock .tetrisSettingNote {
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.45;
}

#tetrisShell .tetrisMissionBar {
    padding: 10px 12px;
    gap: 10px;
    margin-bottom: 10px;
}
#tetrisShell .tetrisMissionText {
    font-size: 14px;
}
#tetrisShell .tetrisMissionStatus {
    min-width: 78px;
    padding: 6px 8px;
}

.tetrisGuide {
    max-width: 540px;
    margin: 12px auto 0;
}
.tetrisGuideCard {
    padding: 10px 12px;
    border-radius: 14px;
}
.tetrisGuideCard h3 {
    margin: 0 0 8px;
    font-size: 13px;
}
.tetrisGuideList {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 6px 10px;
}
.tetrisGuideList li {
    margin: 0;
    padding: 7px 8px;
    border: 1px solid #ebf0f8;
    border-radius: 10px;
    background: #f9fbff;
    font-size: 12px;
    line-height: 1.35;
}
.tetrisGuideList li:first-child {
    padding-top: 7px;
}
.tetrisGuideKey {
    gap: 4px;
}
.tetrisGuideKey kbd {
    min-width: 24px;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 11px;
}
.tetrisTips {
    margin-top: 8px;
    padding: 9px 10px;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.5;
}
@media screen and (max-width: 767px) {
    #inputBlock .tetrisSettingTable th,
    #inputBlock .tetrisSettingTable td {
        padding: 7px 8px;
    }
    #inputBlock .inputSelect {
        max-width: none;
        width: 100%;
    }
    .tetrisGuideList {
        grid-template-columns: 1fr;
    }
}

/* custom speed/difficulty wording update */
#inputBlock .inputSelect.smallSelect {
    width: 132px;
    max-width: 132px;
}
