* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #b8d8e8;
    font-family: 'Comic Sans MS', cursive;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Paper texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
    z-index: 0;
}

.wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.table-scroll {
    flex: 1;
    overflow-x: auto;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    min-width: 340px;
    border-left: 2px solid #5a9ab8;
    border-right: 2px solid #5a9ab8;
}

/* Column sizing — landscape */
th:first-child,
td:first-child {
    width: 225px;
    min-width: 225px;
}

th:not(:first-child),
td:not(:first-child) {
    width: 90px;
    min-width: 90px;
}

/* Fixed row height */
thead tr th,
tbody tr td,
tfoot tr td {
    height: 44px;
}

/* Portrait: narrow label col, rows wrap to two lines */
@media (orientation: portrait) {

    th:first-child,
    td:first-child {
        width: 130px;
        min-width: 130px;
        white-space: normal;
        word-break: break-word;
        line-height: 1.25;
    }

    tbody tr td,
    tfoot tr td {
        height: auto;
        min-height: 44px;
        padding-top: 6px;
        padding-bottom: 6px;
    }
}

/* Header row */
thead tr th {
    padding: 10px 8px;
    border-right: 2px solid #7bafc8;
    border-bottom: 2px solid #5a9ab8;
    border-top: 2px solid #5a9ab8;
    font-family: 'Comic Sans MS', cursive;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a4a60;
    background: transparent;
    text-align: center;
}

thead tr th:first-child {
    padding: 0 !important;
    border-right: 2px solid #5a9ab8;
    vertical-align: middle;
    line-height: 0;
}

/* Name row */
tbody tr:first-child td {
    border-bottom: 1px dashed #5a9ab8;
    padding: 6px 8px;
}

/* Body rows */
tbody tr td {
    border-bottom: 1px dashed #7bafc8;
    border-right: 1px dashed #7bafc8;
    padding: 7px 8px;
    text-align: center;
    background: transparent;
}

tbody tr td:last-child {
    border-right: none;
}

thead tr th:last-child {
    border-right: none;
}

tbody tr td:first-child {
    text-align: left;
    padding-left: 14px;
    font-family: 'Comic Sans MS', cursive;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1a4a60;
    border-right: 2px solid #5a9ab8;
}

/* Total row */
tfoot tr td {
    border-top: 2px solid #5a9ab8;
    border-bottom: 2px solid #5a9ab8;
    border-right: 1px dashed #7bafc8;
    padding: 9px 8px;
    text-align: center;
    font-family: 'Comic Sans MS', cursive;
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a4a60;
    background: transparent;
}

tfoot tr td:first-child {
    text-align: left;
    padding-left: 14px;
    border-right: 2px solid #5a9ab8;
}

tfoot tr td:last-child {
    border-right: none;
}

/* Inputs */
input[type="number"],
input[type="text"] {
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Comic Sans MS', cursive;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a3a50;
    text-align: center;
    width: 100%;
    padding: 2px 0;
}

input[type="text"].name-input {
    font-size: 1.05rem;
    text-align: center;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Reset button */
.reset-btn {
    color: #1a4a60;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    width: 100%;
    height: 44px;
    font-family: 'Comic Sans MS', cursive;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    display: block;
    transition: background 0.15s, color 0.15s;
}

.reset-btn:hover {
    color: red;
}

/* Hidden */
.hidden-col {
    display: none;
}