/* * { */
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

:root{
    --bg:#f7f7f2;
    --bg-accent:#eef0f4;
    --panel:#ffffff;
    --panel2:#5b55c7;
    --panel3:#8178df;
    --row:#f3f4ff;
    --row-hover:#e7e8ff;
    --text:#25258b;
    --text-light:#ffffff;
    --muted:#5c5ca0;
    --border:#d6d7eb;
    --border-strong:#7269dd;
    --purple:#6758ee;
    --purple-dark:#29258d;
    --purple-light:#8b7cff;
    --green:#b7f348;
    --green-dark:#75ce67;
    --green-light:#dcff66;
    --gold:#d4af37;
    --silver:#c0c0c0;
    --bronze:#cd7f32;
    --shadow:0 4px 14px rgba(40,37,141,.18);
    --move-bg:rgba(255,255,255,.78);
    --stat-bg:rgba(255,255,255,.86);
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    font-family: "Google Sans", Tahoma, Arial, sans-serif;
    color: var(--text);
}

.ots,
.cts {
    background-size: 100% 100%;
    width: 1020px;
    height: 1320px;
    margin: 4px auto;
    position: relative;
    font-family: "Google Sans", Arial, sans-serif;
    color: #000;
}

.cts {
    background: url("CTS.png") no-repeat;
    background-size: 100% 100%;
}

.sheet-scale {
    width: 1020px;
    height: 1320px;
    transform-origin: top left;
    margin: 0 auto;
}

.team-sheet {
    position: absolute;
    left: 30px;
    top: 268px;
    width: 960px;
    height: 995px;
    display: grid;
    grid-template-columns: 469px 469px;
    grid-template-rows: repeat(3, 321px);
    row-gap: 16px;
    column-gap: 18px;
}

.mon-card {
    position: relative;
    display: grid;
    grid-template-columns: 381px 90px;
    grid-template-rows: 52px 40px repeat(6, 40px);
}

.cell {
    outline: none;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-align: left;
}

[contenteditable="true"] {
    cursor: text;
    background: rgba(183, 243, 72, 0.14);
    transition: background 0.1s;
    -webkit-user-select: text;
    user-select: text;
    outline: none;
}

[contenteditable="true"]:focus {
    outline: none;
    background: rgba(220, 255, 102, 0.85);
}

.mon-name {
    grid-column: 1 / 3;
    grid-row: 1;
    padding: 13px 14px 0 120px;
    font-size: 24px;
    font-weight: 700;
}

.stat-alignment {
    grid-column: 1 / 3;
    grid-row: 2;
    padding: 7px 14px 0 120px;
    font-size: 23px;
    font-weight: 700;
}

.ability {
    grid-column: 1;
    grid-row: 3;
    padding: 7px 14px 0 120px;
    font-size: 23px;
    font-weight: 700;
}

.item {
    grid-column: 1;
    grid-row: 4;
    padding: 7px 14px 0 120px;
    font-size: 23px;
    font-weight: 700;
}

.moves {
    grid-column: 1;
    grid-row: 5 / 9;
    display: grid;
    grid-template-rows: repeat(4, 39px);
}

.moves .cell {
    padding: 6px 14px 0 120px;
    font-size: 23px;
    font-weight: 700;
}

.stats {
    grid-column: 2;
    grid-row: 3 / 9;
    display: grid;
    grid-template-rows: repeat(6, 38px);
}

.stats span {
    display: block;
    padding: 12px 4px 0;
    font-size: 14px;
    font-weight: 700;
    outline: none;
    text-align: center;
}

.sheet-info {
    position: absolute;
    inset: 0;
    font-family: "Google Sans", Arial, sans-serif;
    font-weight: 700;
    color: #000;
}

.field,
.checkbox {
    position: absolute;
    outline: none;
    cursor: text;
}

.field {
    height: 20px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-align: left;
    font-size: 14px;
    line-height: 20px;
    padding: 0 4px;
}

.player-name {
    left: 236px;
    top: 130px;
    width: 280px;
}

.trainer-name {
    left: 236px;
    top: 166px;
    width: 280px;
}

.battle-team {
    left: 236px;
    top: 202px;
    width: 280px;
}

.switch-name {
    left: 236px;
    top: 242px;
    width: 280px;
}

.player-id {
    left: 722px;
    top: 166px;
    width: 260px;
}

.dob {
    position: absolute;
    left: 722px;
    top: 202px;
    width: 260px;
    height: 20px;
    display: grid;
    grid-template-columns: 68px 68px 1fr;
    column-gap: 8px;
}

.dob > div {
    outline: none;
    overflow: hidden;
    white-space: nowrap;
    text-align: center;
    font-size: 14px;
    line-height: 20px;
    cursor: text;
}

.support-id {
    left: 722px;
    top: 242px;
    width: 260px;
}

.checkbox {
    width: 20px;
    height: 20px;
    text-align: center;
    font-size: 18px;
    line-height: 20px;
    padding: 0;
}

.juniors {
    left: 786px;
    top: 124px;
}

.seniors {
    left: 878px;
    top: 124px;
}

.masters {
    left: 961px;
    top: 124px;
}

a {
    color: var(--purple-dark);
    font-weight: 700;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    transition: color 0.15s ease, background 0.15s ease;
}

a:hover {
    color: var(--purple-dark);
    background: var(--green);
}

html.dark a {
    color: var(--green-light);
}

html.dark a:hover {
    color: var(--purple-dark);
    background: var(--green);
}

.window {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.titlebar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:18px;
    background:linear-gradient(90deg,var(--purple-dark),var(--panel2));
    color:var(--text-light);
    padding:10px 14px;
    border-bottom:4px solid var(--green);
    font-weight:700;
    font-size:13px;
    letter-spacing:.03em;
    box-shadow:0 2px 8px rgba(0,0,0,.16);
}

.titlebar a{
    color:#dcff66 !important; 
	text-decoration: none;
}
.titlebar a:hover{
    color:#17154d !important;
	background: #f7f7f2;
}



.brand{
    display:flex;
    align-items:center;
    gap:11px;
    min-width:0;
}

.brand img{
    width:64px;
    height:64px;
    object-fit:contain;
}

.brand h1{
    margin:0;
    font-size:22px;
    line-height:1.05;
    letter-spacing:0;
}

.brand p{
    margin:4px 0 0;
    font-size:12px;
}

.content {
    flex: 1;
    padding: 18px 6px 60px;
    text-align: center;
    margin: 0 auto;
    width: 100%;
    overflow: hidden;
}

.nav {
    margin: 10px 24px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.nav br {
    display: none;
}

#themeBtn {
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 4px;
    font-size: 18px;
    background: transparent;
    color: var(--text);
    border: none;
    border-radius: 50%;
}

#themeBtn:hover {
    background: var(--row-hover);
    color: var(--text);
}

button,
select {
    font-family: inherit;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
}

button {
    min-height: 38px;
    padding: 8px 14px;
    background: var(--purple);
    color: var(--text-light);
    border: 2px solid var(--purple);
    border-radius: 999px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
}

button:hover {
    background: var(--green);
    color: var(--purple-dark);
    border-color: var(--green);
}

button:active {
    background: var(--green-dark);
    color: var(--purple-dark);
    border-color: var(--green-dark);
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(183, 243, 72, 0.55);
    outline-offset: 2px;
}

select {
    min-height: 38px;
    padding: 7px 32px 7px 10px;
    background: var(--row);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
}

select:hover {
    background: var(--row-hover);
    color: var(--text);
    border-color: var(--purple-light);
}

select option {
    background: var(--panel);
    color: var(--text);
}

.pokemon-wrap {
    grid-column: 3;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.bottom-box {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.type {
    color: #fff;
    border-radius: 999px;
    font-weight: 700;
}

.type.grass {
    background: #7ac74c;
}

.type.poison {
    background: #a33ea1;
}

.type.fire {
    background: #ee8130;
}

.type.water {
    background: #6390f0;
}

.type.electric {
    background: #f7d02c;
    color: #111;
}

.type.ice {
    background: #96d9d6;
    color: #111;
}

.type.fighting {
    background: #c22e28;
}

.type.ground {
    background: #e2bf65;
    color: #111;
}

.type.flying {
    background: #a98ff3;
}

.type.psychic {
    background: #f95587;
}

.type.bug {
    background: #a6b91a;
}

.type.rock {
    background: #b6a136;
}

.type.ghost {
    background: #735797;
}

.type.dragon {
    background: #6f35fc;
}

.type.dark {
    background: #705746;
}

.type.steel {
    background: #b7b7ce;
    color: #111;
}

.type.fairy {
    background: #d685ad;
}

.type.normal {
    background: #a8a77a;
}

table {
    width: 100%;
    overflow: hidden;
    background: var(--panel);
    color: var(--text);
    border: 2px solid var(--border);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 14px;
    box-shadow: var(--shadow);
}

th,
td {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 7px;
    text-align: center;
    background: var(--row);
}

th:last-child,
td:last-child {
    border-right: none;
}

tr:last-child td {
    border-bottom: none;
}

th {
    background: var(--panel2);
    color: var(--text-light);
    position: sticky;
    top: 0;
    z-index: 1;
    font-weight: 700;
}

tr:hover td {
    background: var(--row-hover);
}

.team-modal {
    position: fixed;
    inset: 0;
    background: rgba(21, 18, 68, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 1;
    transition: opacity 0.2s ease;
    z-index: 9999;
}

.team-modal.hidden {
    pointer-events: none;
    opacity: 0;
}

.team-box {
    width: min(600px, 100%);
    max-height: calc(100vh - 32px);
    overflow: hidden;
    background: var(--panel);
    color: var(--text);
    padding: 18px;
    border-radius: 16px;
    border: 2px solid var(--border-strong);
    box-shadow: var(--shadow);
}

#teamInput {
    width: 96%;
    height: 260px;
    resize: vertical;
    background: var(--row);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    font: 14px monospace;
}

#teamInput:hover {
    border-color: var(--purple-light);
}

#teamInput:focus {
    border-color: var(--green-dark);
    outline: none;
}

.team-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.team-actions button {
    padding: 8px 14px;
}

.exporting [contenteditable="true"] {
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    caret-color: transparent !important;
}

.exporting-ots .stats span {
    color: transparent !important;
}

.exporting-ots .player-id,
.exporting-ots .dob,
.exporting-ots .support-id {
    color: transparent !important;
}

.exporting-ots .cts {
    background-image: url("OTS.png") !important;
}

::selection {
    background: var(--green);
    color: var(--purple-dark);
}

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-accent);
}

::-webkit-scrollbar-thumb {
    background: var(--purple);
    border: 3px solid var(--bg-accent);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--green-dark);
}

.titlebar a {
	color: var(--bg);
}


@media (max-width: 720px) {
    body {
        padding: 0;
    }

    .titlebar {
        padding: 10px;
        font-size: 15px;
    }

    .titlebar small {
        margin-left: 44px !important;
    }

    .nav {
        margin: 8px 4px 0;
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .nav button {
        width: 100%;
    }

    #themeBtn {
        width: 100%;
        border-radius: 8px;
    }

    .content {
        padding: 8px 4px 40px;
        margin-top: 8px;
    }

    .team-modal {
        align-items: flex-start;
    }

    .team-box {
        padding: 12px;
        border-radius: 12px;
    }

    #teamInput {
        min-height: 260px;
    }
}