@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&display=swap');

html {
    overflow-y: scroll;
}

body {
    font-family: 'Cinzel', serif;
    background-color: #1a1a1a;
    background-image: url('https://www.toptal.com/designers/subtlepatterns/uploads/cartographer.png');
    color: #f0e6d2;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.site-header h1 {
    color: #c89b3c;
    text-shadow: 1px 1px 2px #000;
    margin: 0 0 15px 0;
    font-size: 2.5em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-header h1 img {
    height: 1.5em; 
    margin-right: 15px; 
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-link {
    color: #a0937d;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 1.1em;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-link:not(.disabled):hover {
    color: #f0e6d2;
    background-color: #4a3c28;
}

.nav-link.active {
    color: #f0e6d2;
    background-color: #8c6b2c;
    border-color: #c89b3c;
    text-shadow: 1px 1px 1px #000;
}

.nav-link.disabled {
    color: #5c4b28;
    cursor: not-allowed;
}

main {
    padding: 20px;
    display: flex;
    justify-content: center;
}

.page-content.hidden {
    display: none;
}

.container {
    width: 750px; 
    box-sizing: border-box; 
    background-color: rgba(18, 12, 8, 0.85);
    padding: 25px 35px;
    border-radius: 30px;
    border: 3px solid #4a3c28;
    box-shadow: 0 0 15px #000, inset 0 0 10px rgba(0,0,0,0.5);
    text-align: center;
    position: relative;
}

.tool-header h1, #page-inicio h2, #page-conversor-rc h2 {
    color: #c89b3c;
    text-shadow: 1px 1px 2px #000;
    margin: 0 0 20px 0;
    font-weight: 700;
}

main p {
    color: #a0937d;
}

.charms-fieldset, .player-stats-fieldset, .rc-converter-fieldset {
    border: 1px solid #4a3c28;
    border-radius: 4px;
    margin-bottom: 25px;
    padding: 15px;
}
.charms-fieldset legend, .player-stats-fieldset legend, .rc-converter-fieldset legend {
    color: #c89b3c;
    padding: 0 10px;
    font-weight: 700;
}
.charm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
    text-align: left;
}
.charm-item {
    display: flex;
    align-items: center;
    gap: 1px;
    font-size: 1em;
    min-height: 30px;
}
.charm-item label {
    width: 117px;
    flex-shrink: 0; 
    cursor: pointer;
    white-space: nowrap;
}
.charm-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.mode-switcher {
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid #4a3c28;
}
.mode-btn {
    flex-grow: 1;
    padding: 10px 15px;
    border: none;
    background-color: #3a2c18;
    color: #a0937d;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 1.1em;
    transition: all 0.3s ease;
    margin: 0;
    border-radius: 0;
}
.mode-btn:not(:last-child) {
    border-right: 1px solid #4a3c28;
}
.mode-btn.active {
    background-color: #8c6b2c;
    color: #f0e6d2;
    text-shadow: 1px 1px 2px #000;
}

.analyzer-container {
    display: grid;
    align-items: center; 
}

#individual-analyzer,
#hunt-analyzer {
    grid-area: 1 / 1; 
}

.analyzer-content.hidden {
    display: none;
}

#calculateBtn {
    display: none;
}

.player-stats-fieldset, .rc-converter-fieldset {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

#page-calculadora fieldset {
    border: 1px solid #4a3c28;
    border-radius: 4px;
    margin-bottom: 15px;
    padding: 15px;
}

.full-width {
    grid-column: 1 / -1;
}

.input-group {
    text-align: left;
}
.input-group.optional label::after {
    content: " (opcional)";
    font-style: italic;
    color: #a0937d;
    font-size: 0.8em;
}

input[type="number"], input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #4a3c28;
    background-color: #1a1a1a;
    color: #f0e6d2;
    border-radius: 3px;
    font-family: 'Cinzel', serif;
    font-size: 1em;
    text-align: center;
    box-sizing: border-box;
    height: 42px;
}

textarea#hunt-log {
    width: 100%;
    height: 150px;
    padding: 10px;
    border: 1px solid #4a3c28;
    background-color: #1a1a1a;
    color: #f0e6d2;
    border-radius: 3px;
    font-family: monospace;
    font-size: 1em;
    box-sizing: border-box;
}

.search-container { 
    position: relative;
    margin-bottom: 20px;
 }

.clear-button { 
    display: none; 
    position: absolute; 
    right: 15px; 
    top: 45px; 
    transform: translateY(-50%); 
    font-size: 40px; 
    font-weight: 900; 
    color: #e74c3c; 
    cursor: pointer; 
    transition: all 0.2s; 
    z-index: 5; 
    line-height: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8); 
}
.clear-button:hover { 
    color: #ff7979; transform: translateY(-50%) scale(1.1); 
}

.search-results { display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 1000; background: #1e1610; border: 2px solid #4a3c28; max-height: 250px; overflow-y: auto; text-align: left; }
.search-results div { display: flex; align-items: center; padding: 10px; border-bottom: 1px solid #3a2c18; cursor: pointer; }
.search-results div:hover { background-color: #c89b3c; color: #1a1a1a; }
.search-results img { width: 32px; height: 32px; margin-right: 15px; image-rendering: pixelated; }

button {
    grid-column: 1 / -1;
    padding: 12px;
    border: 2px solid #4a3c28;
    border-radius: 3px;
    background-color: #8c6b2c;
    color: #f0e6d2;
    font-family: 'Cinzel', serif;
    font-size: 1.2em;
    font-weight: 700;
    text-shadow: 1px 1px 2px #000;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}
button:hover { background-color: #c89b3c; border-color: #f0e6d2; }
button:disabled { background-color: #5c4b28; color: #a0937d; cursor: not-allowed; }

.result-container {
  border: 1px solid #4a3c28;
  padding: 10px;
  text-align: left;
  min-height: 50px; 
  height: auto;      
}

.result-container h3, .result-container h4 {
    text-align: center;
    color: #ffffff; 
    font-weight: normal;
    font-weight: 600;
    font-size: 0.9em;
    margin: 15px 0 5px 0; 
  
}

.recommendation-box p:first-child {
    color: #c89b3c;
    margin-bottom: 8px;
    border-bottom: none;
}

.recommendation-box {
    margin-bottom: 15px; 
}


.result-container .recommendation-box { background-color: rgba(200, 155, 60, 0.1); border: 1px solid #c89b3c; padding: 15px; border-radius: 4px; text-align: center; margin-bottom: 20px; }
.result-container .recommendation-box p { margin: 0; color: #ffffff; font-weight: 600; }
.result-container .recommendation-box .charm-name { font-size: 1.4em; color: #c89b3c; font-weight: 700; }
.result-container .ranking-list { list-style-type: none; padding: 0; }
.result-container .ranking-list li { display: flex; justify-content: space-between; padding: 8px 0;}
.result-container .ranking-list li:last-child { border-bottom: none; }
.damage-value { font-weight: bold; color: #2ecc71; }
.cheaper-value { font-weight: bold; color: #2ecc71; }
.expensive-value { font-weight: bold; color: #e74c3c; }


.tier-selector {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex; 
    gap: 4px;
    flex-shrink: 0; 
}
.tier-selector.visible {
    visibility: visible; 
    opacity: 1;
}
.tier-btn {
    padding: 4px 8px;
    font-size: 0.8em;
    background-color: #3a2c18;
    color: #a0937d;
    border: 1px solid #4a3c28;
    border-radius: 3px;
    cursor: pointer;
    margin: 0;
    white-space: nowrap; 
}
.tier-btn.active {
    background-color: #8c6b2c;
    color: #f0e6d2;
    border-color: #c89b3c;
}

#rc-result {
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(200, 155, 60, 0.1);
    border: 1px solid #c89b3c;
    border-radius: 4px;
    font-size: 1.2em;
    color: #f0e6d2;
    text-align: center;
}

.lost-damage-value {
    font-weight: bold;
    color: #e74c3c; 
}

#analyze-hunt-btn {
    display: none;
}

#calculate-rc-btn {
    display: none;
}

.site-header h1 img {
    height: 2em; 
    vertical-align: middle; 
    margin-right: 15px; 
}

@media (max-width: 768px) {
    main {
        padding: 15px 0; 
    }

    .container {
        width: 100%;
        border-left: none;
        border-right: none;
        border-radius: 0; 
        padding: 20px 15px; 
        box-sizing: border-box; 
    }

    .site-header h1 {
        font-size: 1.8em; 
    }
    
    .main-nav {
        flex-direction: column; 
        align-items: center;   
        gap: 12px;
    }
    
    .nav-link {
        width: 95%;           
        box-sizing: border-box;
        text-align: center;
    }

    .tool-header h1 {
        font-size: 1.5em; 
    }

    .charm-grid,
    .player-stats-fieldset,
    .rc-converter-fieldset {
        grid-template-columns: 1fr; 
    }
}

.ranking-list.centered li {
    justify-content: center;
    gap: 15px; 
}

.hunt-text-content {
    display: flex;
    flex-direction: column; 
    align-items: flex-start; 
    justify-content: center; 
    white-space: nowrap; 
}

.hunt-col-monster {
    flex: 1; 
    text-align: right;
    padding-right: 15px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.hunt-col-charm {
    flex: 1; 
    text-align: left;
    padding-left: 15px;
}

.hunt-monster-image {
    width: 32px;
    height: 32px;
    margin-right: 10px; 
    image-rendering: pixelated;
}

.hunt-monster-name {
    font-size: 1.1em;
    color: #f0e6d2;
}

.ranking-list .charm-name {
    color: #c89b3c;
    font-weight: 700;
}

.recommendation-box p > .damage-value {
    font-size: 1.4em;
}

.selected-monster-display {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    background: rgba(0,0,0,0.3); 
    border: 1px solid #4a3c28; 
    border-radius: 4px; 
    padding: 15px; 
    margin-top: 20px; 
}

#selectedMonsterImage {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
}

#selectedMonsterName {
    font-weight: 700;
    font-size: 1.2em;
    color: #c89b3c;
    margin: 0; 
}

.resistance-fieldset {
    width: 100%;
    border: 1px solid #4a3c28;
    border-radius: 4px;
    padding: 10px;
    margin: 0;
    box-sizing: border-box;
}
.resistance-fieldset legend {
    color: #c89b3c;
    font-size: 0.9em;
    padding: 0 5px;
}

.resistance-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 480px; 
    margin: 0 auto; 
}

.resistance-item {
    display: flex;
    align-items: center;
    background-color: #1a1a1a;
    border: 1px solid #3a2c18;
    border-radius: 4px;
    padding: 3px;
    gap: 4px;
}

.resistance-item img {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.resistance-bar-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    height: 16px;
    background-color: rgba(0,0,0,0.3);
    border-radius: 2px;
    overflow: hidden;
}

.resistance-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    border-radius: 2px;
}

.resistance-bar-container span {
    position: relative;
    z-index: 1;
    font-size: 0.75em;
    font-weight: bold;
    color: #f0e6d2;
    text-shadow: 1px 1px 2px #000;
}

.resistance-value {
    flex-grow: 1;
    text-align: center;
    font-size: 0.8em;
    font-weight: bold;
    color: #1a1a1a;
    text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.1);
    padding: 3px;
}

.resistance-green { background-color: #2ecc71; }
.resistance-yellow { background-color: #f1c40f; }
.resistance-red { background-color: #e74c3c; }
.resistance-white { background-color: #f0e6d2; }

.ranking-list.centered li {
    justify-content: center;
    gap: 15px; 
}