body {
    font-family: Arial, sans-serif;
    max-width: 660px;
    margin: 30px auto;
    background: #f4f4f4;
}

h2 {
    text-align: center;
    margin-bottom: 8px;
}

.save-bar {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-bottom: 4px;
}

.save-bar button {
    padding: 5px 14px;
    font-size: 0.85em;
    border: 1px solid #999;
    border-radius: 6px;
    background: #f0f0f0;
    cursor: pointer;
}

.save-bar button:hover {
    background: #ddd;
}

.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
}

.tab-btn {
    padding: 3.5px 11px;
    font-size: 0.9em;
    border: 1px solid #ccc;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: #e0e0e0;
    cursor: pointer;
    text-decoration: none;
    color: #333;
}

.tab-btn.active {
    background: #fff;
    font-weight: bold;
}

.card {
    background: white;
    border-radius: 0 8px 8px 8px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.field {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.field.med {
    flex: 0 0 110px;
}

.field.tiny {
    flex: 0 0 52px;
}

label {
    font-weight: bold;
    font-size: 0.85em;
    margin-bottom: 2px;
}

input[type=text],
input[type=number] {
    border: none;
    border-bottom: 1px solid #999;
    background: transparent;
    font-size: 0.95em;
    padding: 2px 4px;
    width: 100%;
    outline: none;
    box-sizing: border-box;
}

textarea {
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    resize: vertical;
    font-size: 0.9em;
    padding: 4px;
    box-sizing: border-box;
}

select {
    border: none;
    border-bottom: 1px solid #999;
    background: transparent;
    font-size: 0.95em;
    padding: 2px 4px;
    width: 100%;
    outline: none;
}

hr {
    border: none;
    border-top: 0px solid #ddd;
    margin: 2px 0;
}

.ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82em;
}

.ref-table td {
    padding: 3px 4px;
    vertical-align: top;
    word-wrap: break-word;
}

.ref-table tr:nth-child(even) td {
    background: #f7f7f7;
}

.ref-table .cat {
    font-weight: bold;
    font-size: 0.8em;
    color: #555;
    background: #eee !important;
    padding: 4px 6px;
}

.hidden {
    display: none;
}

.sk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82em;
}

.sk-table td,
.sk-table th {
    padding: 3px 4px;
    vertical-align: middle;
    text-align: center;
}

.sk-table td:first-child {
    text-align: left;
}

.sk-table th {
    font-size: 0.8em;
    color: #666;
}

.sk-table tr:nth-child(even) td {
    background: #f7f7f7;
}

.eq-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.eq-btn {
    flex: 1;
    padding: 6px 4px;
    font-size: 0.82em;
    border: 1px solid #999;
    border-radius: 6px;
    background: #f9f9f9;
    cursor: pointer;
}

.eq-btn:hover {
    background: #e8e8e8;
}

.eq-list {
    font-size: 0.85em;
    margin: 6px 0 0;
    padding: 8px;
    background: #f7f7f7;
    border-radius: 6px;
}

.eq-list ul {
    margin: 4px 0 0;
    padding-left: 18px;
}

#eq-toggle {
    font-size: 0.78em;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    text-decoration: underline;
    margin-top: 4px;
    margin-right: 6px;
}

#wep-toggle-btn {
    font-size: 0.78em;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    text-decoration: underline;
    margin-bottom: 4px;
}

.oracle-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88em;
    margin-top: 6px;
}

.oracle-table td {
    padding: 5px 8px;
}

.oracle-table td:first-child {
    font-weight: bold;
    width: 24px;
    text-align: center;
}

.oracle-table td.highlight {
    background: #ffe066 !important;
    font-weight: bold;
}

.d66-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88em;
    margin-top: 6px;
}

.d66-table td {
    padding: 4px 8px;
}

.d66-table td:first-child {
    font-weight: bold;
    width: 30px;
    text-align: center;
}

.d66-table tr:nth-child(even) td {
    background: #f7f7f7;
}

.d66-table td.highlight {
    background: #ffe066 !important;
    font-weight: bold;
}

.ref-table td.highlight {
    background: #ffe066 !important;
    font-weight: bold;
}

#quest-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 50;
    align-items: center;
    justify-content: center;
}

#quest-overlay.open {
    display: flex;
}

#quest-box {
    background: #fff;
    border-radius: 10px;
    padding: 24px 28px;
    max-width: 480px;
    width: 94%;
    max-height: 80vh;
    overflow-y: auto;
}

#quest-box h3 {
    margin: 0 0 12px;
}

.quest-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88em;
}

.quest-table td {
    padding: 6px 8px;
    vertical-align: top;
    border-bottom: 1px solid #eee;
}

.quest-table td:first-child {
    font-weight: bold;
    width: 28px;
    text-align: center;
}

#quest-close {
    display: block;
    margin: 14px auto 0;
    padding: 5px 22px;
    background: #555;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}