:root {
    --paper-bg: #f8f1e5;
    --paper-dark: #e6d5b8;
    --ink: #3d2b1f;
    --gold: #b8860b;
    --line-1: #3182ce;
    --line-2: #38a169;
    --line-3: #e53e3e;
    --cell-bg: #ffffff;
    --cell-active: #5d4037;
}

body {
    background-color: #121212;
    background-image: radial-gradient(#2c2c2c 1px, transparent 1px);
    background-size: 20px 20px;
    font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
    color: var(--ink);
}

.container {
    background: var(--paper-bg);
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)),
        url('https://www.transparenttextures.com/patterns/parchment.png');
    width: 100%;
    max-width: 480px;
    padding: 40px 30px;
    border-radius: 4px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 0 100px rgba(184, 134, 11, 0.1);
    border: 1px solid #d4c4a8;
    position: relative;
    overflow: hidden;
}

.container::before {
    content: "";
    position: absolute;
    top: 10px; left: 10px; right: 10px; bottom: 10px;
    border: 2px solid var(--gold);
    opacity: 0.3;
    pointer-events: none;
}

h1 {
    text-align: center;
    margin: 0;
    font-size: 24px;
    color: #4a3728;
    letter-spacing: 2px;
}

.subtitle {
    text-align: center;
    font-size: 12px;
    color: #8c7a6b;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 600;
}

.reset-btn {
    background: #5d4037;
    color: #f8f1e5;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.reset-btn:hover {
    background: #3e2723;
    transform: translateY(-1px);
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    background: rgba(0,0,0,0.05);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.cell {
    aspect-ratio: 1;
    background: var(--cell-bg);
    border: 1px solid #dcd0bc;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.cell:hover {
    background: #fffaf0;
    border-color: var(--gold);
}

.cell.selected {
    background: var(--cell-active);
    color: #ffd700;
    border-color: #3e2723;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: scale(0.95);
}

.cell.selected::after {
    content: "★";
    filter: drop-shadow(0 0 2px rgba(255,215,0,0.5));
}

.suggestion-card {
    background: rgba(255, 255, 255, 0.7);
    border-left: 4px solid var(--gold);
    padding: 15px;
    border-radius: 0 6px 6px 0;
    margin-bottom: 25px;
    font-size: 14px;
    line-height: 1.6;
    animation: fadeIn 0.4s ease-out;
}

.suggestion-card.perfect { border-color: #d69e2e; background: #fffaf0; }
.suggestion-card.good { border-color: var(--line-2); background: #f0fff4; }
.suggestion-card.bad { border-color: var(--line-3); background: #fff5f5; }

.result-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.prob-item {
    background: rgba(255,255,255,0.4);
    padding: 10px;
    border-radius: 6px;
}

.prob-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 700;
}

.prob-details {
    font-size: 11px;
    color: #8c7a6b;
    font-weight: normal;
    margin-left: 5px;
}

.progress-container {
    height: 6px;
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    transition: width 0.6s cubic-bezier(0.17, 0.67, 0.83, 0.67);
}

.bar-0 { background: #a0aec0; }
.bar-1 { background: var(--line-1); }
.bar-2 { background: var(--line-2); }
.bar-3 { background: var(--line-3); }

.placeholder-text {
    text-align: center;
    color: #8c7a6b;
    padding: 40px 0;
    font-style: italic;
    font-size: 14px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

hr { border: 0; border-top: 1px solid rgba(0,0,0,0.08); margin: 20px 0; }

.back-link {
    position: absolute;
    top: 20px;
    left: 20px;
    color: var(--ink);
    text-decoration: none;
    font-size: 14px;
    opacity: 0.6;
    transition: opacity 0.2s;
    z-index: 10;
}

.back-link:hover {
    opacity: 1;
    text-decoration: underline;
}
