/* Core layout */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(180deg, #f6f7fb 0%, #e8ebf9 100%);
    color: #1f2933;
}

.page-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px 48px;
    box-sizing: border-box;
}

.main-container {
    width: min(1200px, 100%);
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.page-header {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

@media (min-width: 768px) {
    .page-header {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
        gap: 32px;
    }
}

.title-block {
    max-width: 720px;
}

.title-block h1 {
    margin: 0;
    font-size: clamp(2.4rem, 4vw, 3.2rem);
    font-weight: 700;
    color: #0f172a;
}

.tagline {
    margin: 6px 0 0;
    font-size: 1rem;
    color: #475569;
}

.title-block blockquote {
    margin: 16px 0 0;
    font-size: 1.1rem;
    font-style: italic;
    color: #1f2933;
}

.title-block blockquote span {
    font-style: normal;
    color: #475569;
    display: block;
    margin-top: 8px;
    text-align: right;
}

.definition-card {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(6px);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.definition-card h2 {
    margin: 0 0 10px;
    font-size: 1.1rem;
    color: #0f172a;
}

.definition-card p {
    margin: 0 0 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #334155;
}

.definition-link {
    font-size: 0.9rem;
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 600;
}

.definition-link:hover {
    text-decoration: underline;
}

.grid-section {
    width: 100%;
}

.grid-wrapper {
    width: 100%;
    overflow: auto;
    max-height: calc(120vh - 260px);
    padding: 16px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(148, 163, 184, 0.25);
    border: 1px solid rgba(148, 163, 184, 0.18);
    position: relative;
}

/* Grid Layout */
.grid-container {
    display: grid;
    grid-template-columns: repeat(10, 100px);
    grid-template-rows: repeat(10, 100px);
    gap: 5px;
    justify-content: start;
    align-items: start;
    margin: 0 auto;
}

/* Grid Items */
.grid-item {
    perspective: 1000px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    position: relative;
    z-index: 0;
}

/* Header cells */
.grid-item.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: #2563eb;
    color: white;
    text-align: center;
    font-weight: bold;
    border-radius: 8px;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.grid-item.header a {
    color: inherit;
    text-decoration: none;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.grid-item.col-header {
    top: 0;
    z-index: 300;
}

.grid-item.row-header {
    position: sticky;
    left: 0;
    top: auto;
    z-index: 250;
    background-color: #2563eb;
    color: white;
}

.grid-item.row-header a {
    color: inherit;
    text-decoration: none;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.grid-item.corner-cell {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 400;
    background: linear-gradient(135deg, #2563eb, #1e3a8a);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
}

.grid-item.corner-cell a {
    color: white;
    text-decoration: none;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Flippable cards */
.card {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s;
    z-index: 0;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card .front {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background-color: white;
    color: black;
}

.card .frount .gray {
    background-color: gray;
    color: black;
}

.card .back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: rotateY(180deg);
}

.card .back.red {
    background-color: red;
    color: white;
}

.card .back.green {
    background-color: lime;
    color: white;
}

.card .back.yellow {
    background-color: yellow;
    color: black;
}

.card .back.gray {
    background-color: gray;
    color: black;
}

.transparent {
    background-color: transparent;
    border: none;
}

.site-footer {
    text-align: center;
    font-size: 0.9rem;
    color: #475569;
}

.site-footer a {
    color: #1d4ed8;
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

.tutorial-bar {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 24px;
    z-index: 500;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.tutorial-inner {
    max-width: 720px;
    width: 100%;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 14px;
    padding: 10px 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    backdrop-filter: blur(6px);
    box-shadow: 0 10px 30px rgba(79, 70, 229, 0.2);
    pointer-events: auto;
}

.tutorial-inner p {
    margin: 0;
    font-size: 0.95rem;
    color: #1f2933;
}

.color-green {
    color: lime;
}

.color-red {
    color: red;
}

.color-yellow {
    color: yellow;
}

.tutorial-inner button {
    margin-left: auto;
    background: none;
    border: none;
    color: #1d4ed8;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
}

.tutorial-inner button:hover {
    color: #1e3a8a;
}

.tutorial-hidden {
    display: none;
}
