/* ============================================
   STRINGULATOR - BASE STYLES
   ============================================ */

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

body {
    background-color: #000000;
    color: #FFD700;
    font-family: Monaco, Consolas, 'Courier New', monospace;
    min-height: 100dvh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2rem;
    scrollbar-width: thin;
    scrollbar-color: #FFD700 #000000;
}

body::-webkit-scrollbar {
    width: 12px;
}

body::-webkit-scrollbar-track {
    background: #000000;
}

body::-webkit-scrollbar-thumb {
    background: #FFD700;
    border-radius: 6px;
}

body::-webkit-scrollbar-thumb:hover {
    background: #FFC700;
}

.container {
    width: 100%;
    max-width: min(800px, 95vw);
    padding: 0 clamp(0.25rem, 1vw, 0.75rem);
}

/* ============================================
   HEADER
   ============================================ */

header {
    text-align: center;
    margin-bottom: 1.618rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.618rem;
}

h1 {
    font-size: clamp(1.25rem, 4vw, 2rem);
    font-weight: bold;
    letter-spacing: 2px;
}

h3 {
    font-size: clamp(1.1rem, 3vw, 1.35rem);
    font-weight: bold;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

/* ============================================
   CONTROLS
   ============================================ */

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.config-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.config-group label {
    font-size: clamp(1.1rem, 3vw, 1.35rem);
    font-weight: bold;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn-primary {
    background-color: #FFD700;
    color: #000000;
    border: none;
    padding: 0.75rem 2rem;
    font-family: Monaco, Consolas, 'Courier New', monospace;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
}

.btn-primary:hover {
    background-color: #FFC700;
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background-color: #666;
    color: #333;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: transparent;
    color: #FFD700;
    border: 1px solid #FFD700;
    padding: 0.5rem 1rem;
    font-family: Monaco, Consolas, 'Courier New', monospace;
    font-size: 0.9rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.5rem;
}

.btn-secondary:hover {
    background-color: #FFD700;
    color: #000000;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    min-width: auto;
}

.btn-info {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: transparent;
    border: 2px solid #FFD700;
    color: #FFD700;
    font-family: Monaco, Consolas, 'Courier New', monospace;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-info:hover {
    background-color: #FFD700;
    color: #000000;
}


.btn-remove {
    background-color: transparent;
    color: #FF4444;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem 0.5rem;
    transition: transform 0.2s;
}

.btn-remove:hover {
    transform: scale(1.2);
}

.btn-donate {
    background-color: #FFD700;
    color: #000000;
    border: none;
    padding: 0.75rem 1.5rem;
    font-family: Monaco, Consolas, 'Courier New', monospace;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 1rem;
}

.btn-donate:hover {
    background-color: #FFC700;
    transform: translateY(-1px);
}

/* ============================================
   FORM INPUTS
   ============================================ */

input[type="number"], input[type="text"] {
    background-color: #1a1a1a;
    color: #FFD700;
    border: 1px solid #FFD700;
    padding: 0.5rem;
    font-family: Monaco, Consolas, 'Courier New', monospace;
    font-size: 0.9rem;
    border-radius: 4px;
    width: 100px;
}

input[type="number"]:focus, input[type="text"]:focus {
    outline: none;
    border-color: #FFC700;
}

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

.number-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.number-wrapper input {
    padding-right: 20px;
}

.number-spinners {
    position: absolute;
    right: 1px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* ============================================
   LOCK SYSTEM
   ============================================ */

.lock-icon {
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.2s;
    display: inline-block;
    user-select: none;
}

.lock-icon:hover {
    transform: scale(1.2);
}

.target-icon {
    width: 20px;
    height: 20px;
    display: block;
}

input.locked {
    background-color: #1a1a1a;
    color: #FFD700;
    border: 1px solid #FFD700;
    cursor: text;
}

input.unlocked {
    background-color: #FFD700;
    color: #000000;
    border: 1px solid #FFD700;
    cursor: not-allowed;
}

input.unlocked:focus {
    border-color: #FFD700;
}

/* ============================================
   MAIN TABLE
   ============================================ */

.main-table-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#main-table {
    width: 100%;
    border-collapse: collapse;
    color: #FFD700;
    margin-bottom: 0.5rem;
}

#main-table th {
    padding: 0.1rem 0.4rem;
    border-bottom: 2px solid #FFD700;
    text-align: center;
    font-size: 0.6rem;
    font-weight: bold;
}

#main-table th[data-column] {
    position: relative;
    cursor: pointer;
}

#main-table th[data-column]:hover {
    text-decoration: underline;
}

#main-table th[data-column].unlocked-header {
    text-decoration: underline;
}

#main-table td {
    padding: 0.1rem 0.4rem;
    border-bottom: 1px solid #333;
    text-align: center;
    font-size: 0.55rem;
}

#main-table tbody tr:hover {
    background-color: #0a0a0a;
}

.string-input {
    width: 100%;
    max-width: 120px;
    text-align: center;
}

.tuning-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tuning-input {
    max-width: 80px;
    padding-right: 20px;
}

.tuning-spinners {
    position: absolute;
    right: 1px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.spinner-btn {
    background-color: #1a1a1a;
    color: #FFD700;
    border: none;
    cursor: pointer;
    font-size: 0.5rem;
    padding: 0;
    width: 16px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background-color 0.2s;
}

.spinner-btn:hover:not(:disabled) {
    background-color: #FFD700;
    color: #000000;
}

.spinner-btn:disabled {
    display: none;
}

.spinner-up {
    border-radius: 0 3px 0 0;
}

.spinner-down {
    border-radius: 0 0 3px 0;
}

/* ============================================
   MATCHES TABLE
   ============================================ */

.matches-container {
    width: 100%;
    max-width: 800px;
}

.matches-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

#matches-table-container {
    max-height: 400px;
    overflow-y: auto;
}

#matches-table-container::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
#matches-table *::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

#matches-table-container::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track,
#matches-table *::-webkit-scrollbar-track {
    background: #000000;
    border: 1px solid #FFD700;
}

#matches-table-container::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb,
#matches-table *::-webkit-scrollbar-thumb {
    background: #FFD700;
    border: 1px solid #FFD700;
}

#matches-table-container::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover,
#matches-table *::-webkit-scrollbar-thumb:hover {
    background: #FFC700;
}

#matches-table {
    width: 100%;
    border-collapse: collapse;
}

#matches-table button {
    position: relative;
    -webkit-appearance: none;
    appearance: none;
}

#matches-table button::before,
#matches-table button::after {
    display: none !important;
    content: none !important;
}

#matches-table td::before,
#matches-table td::after,
#matches-table tr::before,
#matches-table tr::after {
    display: none !important;
    content: none !important;
}

#matches-table td {
    padding: 0.5rem 0.5rem;
    border-bottom: 1px solid #333;
    font-size: 0.85rem;
    vertical-align: top;
}

.match-name {
    cursor: pointer;
    color: #FFD700;
    transition: color 0.2s;
}

.match-name:hover {
    color: #FFC700;
    text-decoration: underline;
}

.match-target {
    font-weight: bold;
    text-decoration: underline;
}

.match-string-details {
    margin-top: 0.15rem;
    font-size: 0.7rem;
    color: #999;
    font-family: Monaco, Consolas, 'Courier New', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.empty-state {
    text-align: center;
    color: #666;
    font-style: italic;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
    display: none !important;
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

@media (max-width: 479px) {
    .container {
        padding: 0.5rem;
    }

    h1 {
        letter-spacing: 1px;
    }

    #main-table th,
    #main-table td {
        padding: 0.25rem;
        font-size: 0.75rem;
    }

    .string-input {
        max-width: 80px;
        font-size: 0.85rem;
    }

    .lock-icon {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .controls {
        width: 100%;
    }

    .config-group {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-primary {
        width: 100%;
        min-height: 44px;
    }

    input[type="number"] {
        width: 100%;
    }

    header {
        gap: 1.618rem;
        margin-bottom: 1.618rem;
    }

    header h1 {
        width: 100%;
        font-size: clamp(1.75rem, 6vw, 2.5rem);
        letter-spacing: clamp(0.5rem, 2vw, 1rem);
    }

    main {
        gap: 1rem;
    }

    .controls {
        gap: 1rem;
    }

    .btn-info {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.9rem;
    }

    #main-table th {
        padding: 0.05rem 0.25rem;
        font-size: 0.5rem;
    }

    #main-table td {
        padding: 0.05rem 0.25rem;
        font-size: 0.45rem;
    }

    .string-input {
        max-width: 90px;
        font-size: 0.5rem;
    }

    .config-group label {
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    main {
        gap: 1rem;
    }

    #main-table th,
    #main-table td {
        padding: 0.25rem;
    }
}

/* ============================================
   RESPONSIVE - DESKTOP
   ============================================ */

@media (min-width: 769px) {
    .controls {
        flex-direction: row;
        justify-content: center;
    }

    header h1 {
        width: fit-content;
        min-width: 450px;
        font-size: clamp(1.5rem, 4vw, 2.25rem);
        letter-spacing: 1.2rem;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        max-width: 720px;
    }
}

@media (min-width: 1601px) {
    .container {
        max-width: 1000px;
    }

    .main-table-container {
        max-width: 900px;
    }

    .matches-container {
        max-width: 900px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .btn-primary,
    .btn-donate,
    .lock-icon,
    .btn-remove {
        transition: none;
    }

    .btn-primary:hover,
    .btn-donate:hover,
    .lock-icon:hover,
    .btn-remove:hover {
        transform: none;
    }
}

@media (prefers-contrast: high) {
    .btn-primary {
        border: 2px solid #FFD700;
    }

    #main-table {
        outline: 1px solid #FFD700;
    }
}
