/* --- Root Variables and Base Styles - Ghost of Tsushima Theme --- */
:root {
    /* Core Palette */
    --primary-red: #9A1E1E;
    --dark-red: #7a1818;
    --almost-black: #101010;
    --dark-grey: #222222;
    --medium-grey: #454545;
    --light-grey-text: #cccccc;
    --off-white-accent: #e0e0e0;
    --silver-accent: #bdbdbd;
    --pale-yellow-glow: #fdf8e4;

    /* Highlight Effect Colors */
    --highlight-base-color: #8b0000; /* blood red */
    --highlight-hover-color: white;
    --highlight-underline-color1: #8b0000; /* blood red */
    --highlight-underline-color2: #d4af37; /* gold */
    --highlight-shadow-color: rgba(139, 0, 0, 0.5); /* blood red with opacity */

    /* Derived/Specific Use */
    --panel-bg: rgba(34, 34, 34, 0.95);
    --modal-bg: #282828;
    --button-bg: var(--primary-red);
    --button-text: var(--off-white-accent);
    --button-hover-bg: var(--dark-red);
    --accent-highlight: var(--primary-red);
    --link-hover-color: var(--off-white-accent);
    --danger-color: #b71c1c;
    --danger-hover-color: #d32f2f;
    --border-color: var(--medium-grey);
    --launch-button-color: #4CAF50; /* Green for Launch button */
    --launch-button-hover-color: #45a049;

    --font-main: 'Roboto', 'Segoe UI', 'Helvetica Neue', sans-serif;
    --font-headings: 'Cinzel', 'Georgia', serif;
}

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

html {
    font-size: 16px;
}

body {
    font-family: var(--font-main);
    background-color: var(--almost-black);
    color: var(--light-grey-text);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* --- Dynamic Background & Overlay --- */
.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background: linear-gradient(145deg, var(--almost-black) 60%, var(--dark-grey));
    opacity: 0.9;
}

#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.6;
}

/* --- Main Layout & Container --- */
.container {
    max-width: 1200px;
    margin: 2.5rem auto;
    padding: 1rem 2rem;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

/* Updated Header Styles */
header h1 {
    font-family: var(--font-headings);
    font-size: 3rem;
    letter-spacing: 2px;
    margin-bottom: 0.2rem;
    font-weight: 700;
}

.title-nirvana {
    color: var(--off-white-accent);
    text-shadow: 0 0 10px var(--pale-yellow-glow), 0 0 2px var(--off-white-accent);
}

.title-harbor {
    color: var(--primary-red);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

.subtitle {
    font-family: var(--font-main);
    font-size: 1rem;
    color: var(--silver-accent);
    margin-top: 0.1rem;
    margin-bottom: 1.5rem;
    font-style: italic;
    letter-spacing: 1px;
}

/* --- Tab Navigation --- */
#tab-navigation {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
}

.tab-button {
    background-color: transparent;
    border: 1px solid var(--medium-grey);
    color: var(--light-grey-text);
    padding: 0.7rem 1.5rem;
    font-size: 1rem;
    font-family: var(--font-headings);
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease-out;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.tab-button::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-red);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease-out;
}

.tab-button:hover,
.tab-button:focus {
    color: var(--off-white-accent);
    border-color: var(--primary-red);
    background-color: rgba(154, 30, 30, 0.1);
    outline: none;
    box-shadow: 0 0 10px rgba(154, 30, 30, 0.3);
}

.tab-button:hover::after,
.tab-button:focus::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

.tab-button.active {
    background-color: var(--primary-red);
    color: var(--off-white-accent);
    border-color: var(--primary-red);
    font-weight: bold;
    box-shadow: 0 0 15px rgba(154, 30, 30, 0.6);
}
.tab-button.active::after {
     transform: scaleX(0);
}

/* --- Tab Content --- */
.tab-content {
    display: none;
    padding: 2rem;
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-top: 1.5rem;
    animation: fadeIn 0.6s ease-in-out;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    font-family: var(--font-headings);
    color: var(--primary-red);
    margin-bottom: 1.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--medium-grey);
    padding-bottom: 0.8rem;
    font-size: 1.8rem;
    letter-spacing: 1px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Link List & Items --- */
.link-list {
    list-style: none;
    padding: 0;
}

.link-item {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 1.2rem 1.5rem;
    margin-bottom: 1.2rem;
    border-left: 5px solid var(--medium-grey);
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem; /* Gap between link-info and link-actions */
    transition: background-color 0.3s ease, border-left-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.link-item:hover {
    background-color: rgba(0, 0, 0, 0.45);
    border-left-color: var(--primary-red);
    box-shadow: inset 3px 0 0 var(--primary-red), 0 0 8px rgba(154, 30, 30, 0.3);
}


.link-info {
    flex-grow: 1;
    min-width: 200px;
}

/* Style the actual link title separately if needed */
.link-info a {
    color: var(--light-grey-text);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 500;
    display: inline-block;
    margin-bottom: 0.3rem;
    transition: color 0.2s ease;
}

.link-info a:hover {
    color: var(--link-hover-color);
}

.link-item p {
    font-size: 0.9rem;
    color: var(--silver-accent);
    margin-bottom: 0;
    word-break: break-word;
}

/* Container for all buttons */
.link-actions {
    display: flex;
    align-items: center; /* Align buttons vertically */
    gap: 0.6rem;
    flex-shrink: 0;
}

/* Container specifically for Edit/Delete buttons */
.edit-controls {
    display: flex; /* Keep them in a row */
    gap: inherit; /* Inherit gap from parent */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* --- Buttons --- */
button,
.launch-button
{
    cursor: pointer;
    font-family: inherit;
}

/* Shared styles for all small action buttons in link items */
.launch-button,
.edit-button,
.delete-button {
    background: none;
    border: 1px solid var(--medium-grey);
    color: var(--silver-accent);
    /* Explicitly set padding and font-size for consistency */
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    border-radius: 3px;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
}

/* Optional: Pseudo-elements for Edit/Delete hover fill effect */
.edit-button::before,
.delete-button::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--primary-red); /* Or adjust as needed */
    opacity: 0;
    z-index: -1;
    transition: opacity 0.25s ease;
}

/* Specific Launch Button Styles */
.launch-button {
    border-color: var(--launch-button-color);
    color: var(--launch-button-color);
}

.launch-button i {
    font-size: 0.85em; /* Slightly smaller icon is fine */
}

.launch-button:hover {
    background-color: var(--launch-button-hover-color);
    border-color: var(--launch-button-hover-color);
    color: var(--off-white-accent);
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
}

/* Edit/Delete Hover */
.edit-button:hover {
    color: var(--off-white-accent);
    border-color: var(--primary-red);
    box-shadow: 0 0 8px rgba(154, 30, 30, 0.4);
    /* background-color: rgba(154, 30, 30, 0.1); Optional subtle bg */
}

.delete-button:hover {
    border-color: var(--danger-color);
    background-color: var(--danger-color);
    color: white;
    box-shadow: 0 0 8px rgba(183, 28, 28, 0.5);
}

/* Add Link Button (Tab Header - separate styling) */
.add-link-button {
    background-color: var(--primary-red);
    color: var(--off-white-accent);
    border: 1px solid var(--dark-red);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.25s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.add-link-button:hover {
    background-color: var(--dark-red);
    border-color: var(--primary-red);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(154, 30, 30, 0.5);
}

/* Visibility for Edit Controls Container */
.edit-controls.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* --- Settings Panel --- */
/* ... Settings panel styles remain unchanged ... */
.settings-button { position: fixed; top: 15px; right: 15px; z-index: 1001; background-color: var(--dark-grey); color: var(--silver-accent); border: 1px solid var(--medium-grey); border-radius: 50%; width: 45px; height: 45px; font-size: 1.2rem; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55), box-shadow 0.3s ease, background-color 0.3s ease, color 0.3s ease; }
.settings-button:hover { transform: rotate(90deg) scale(1.1); box-shadow: 0 0 12px var(--primary-red); background-color: var(--medium-grey); color: var(--off-white-accent); }
.settings-panel { position: fixed; top: 70px; right: 15px; width: 260px; background-color: var(--panel-bg); border: 1px solid var(--medium-grey); border-radius: 5px; padding: 1.2rem; z-index: 1000; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6); opacity: 0; visibility: hidden; transform: translateY(-15px) scale(0.95); transition: transform 0.3s ease, opacity 0.3s ease, visibility 0s linear 0.3s; }
.settings-panel.visible { opacity: 1; visibility: visible; transform: translateY(0) scale(1); transition: transform 0.3s ease, opacity 0.3s ease, visibility 0s linear 0s; }
.settings-panel h3 { margin-top: 0; margin-bottom: 1.2rem; color: var(--primary-red); text-align: center; border-bottom: 1px solid var(--medium-grey); padding-bottom: 0.6rem; font-family: var(--font-headings); letter-spacing: 1px; }
.setting-item { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; font-size: 0.95rem; color: var(--light-grey-text); }
.close-settings-btn { display: block; width: 100%; margin-top: 1rem; background-color: var(--medium-grey); color: var(--off-white-accent); padding: 0.6rem; border: 1px solid var(--medium-grey); }
.close-settings-btn:hover { background-color: var(--dark-grey); border-color: var(--silver-accent); }

/* --- Simple Toggle Switch --- */
/* ... Switch styles remain unchanged ... */
.switch { position: relative; display: inline-block; width: 44px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--medium-grey); transition: .4s; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: var(--light-grey-text); transition: .4s; }
input:checked + .slider { background-color: var(--primary-red); }
input:focus + .slider { box-shadow: 0 0 2px var(--primary-red); }
input:checked + .slider:before { background-color: var(--off-white-accent); transform: translateX(22px); }
.slider.round { border-radius: 22px; }
.slider.round:before { border-radius: 50%; }

/* --- Modal Styles --- */
/* ... Modal styles remain unchanged ... */
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.9); background-color: var(--modal-bg); padding: 2.5rem; border-radius: 8px; z-index: 1002; width: 90%; max-width: 550px; border: 1px solid var(--medium-grey); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7); opacity: 0; visibility: hidden; transition: transform 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.3s ease; }
.modal.visible { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.85); z-index: 1001; opacity: 0; visibility: hidden; transition: opacity 0.4s ease; }
.modal-backdrop.visible { opacity: 1; visibility: visible; }
.modal-content h3 { margin-top: 0; margin-bottom: 1.8rem; color: var(--primary-red); text-align: center; font-family: var(--font-headings); font-size: 1.6rem; }
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; margin-bottom: 0.6rem; color: var(--silver-accent); font-size: 0.95rem; }
.form-group input[type="text"], .form-group input[type="url"], .form-group textarea { width: 100%; padding: 0.8rem; background-color: var(--almost-black); border: 1px solid var(--medium-grey); border-radius: 4px; color: var(--light-grey-text); font-size: 1rem; font-family: var(--font-main); transition: border-color 0.3s ease, box-shadow 0.3s ease; }
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--primary-red); box-shadow: 0 0 8px rgba(154, 30, 30, 0.4); }
.form-group textarea { resize: vertical; min-height: 60px; }
.modal-actions { margin-top: 2rem; display: flex; justify-content: flex-end; gap: 0.8rem; }
#save-link-button { background-color: var(--primary-red); color: var(--off-white-accent); border: 1px solid var(--dark-red); padding: 0.8rem 1.5rem; border-radius: 4px; font-weight: bold; transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease; }
#save-link-button:hover { background-color: var(--dark-red); border-color: var(--primary-red); transform: scale(1.05); }
#cancel-modal-button { background-color: transparent; color: var(--silver-accent); border: 1px solid var(--medium-grey); padding: 0.8rem 1.5rem; border-radius: 4px; transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, border-color 0.2s ease; }
#cancel-modal-button:hover { background-color: var(--medium-grey); border-color: var(--silver-accent); color: var(--off-white-accent); transform: scale(1.05); }

/* --- Helper Classes --- */
.hidden {
    display: none !important;
}

/* --- Responsiveness --- */
@media (max-width: 768px) {
    /* ... Responsive styles remain unchanged ... */
    .container { padding: 1rem; margin: 1.5rem auto; }
    header h1 { font-size: 2.2rem; }
    .subtitle { font-size: 0.9rem; margin-bottom: 1rem; }
    #tab-navigation { gap: 0.5rem; }
    .tab-button { padding: 0.6rem 1rem; font-size: 0.9rem; }
    .tab-content h2 { font-size: 1.5rem; }
    .link-item { padding: 1rem; flex-direction: column; align-items: flex-start; }
    .link-item:hover { box-shadow: inset 3px 0 0 var(--primary-red); }
    .link-actions { margin-top: 0.8rem; width: 100%; justify-content: flex-end; }
    .link-actions {
        flex-wrap: wrap; /* Allow buttons to wrap */
    }
    .settings-panel { width: 240px; right: 10px; top: 65px; }
    .settings-button { width: 40px; height: 40px; font-size: 1rem; top: 10px; right: 10px; }
}

/* Hover Highlight Effect for "Harbor" */
.highlight-hover-text {
    color: var(--highlight-base-color);
    position: relative;
    padding: 0 0.1rem;
    transition: color 0.4s ease, text-shadow 0.4s ease;
}

.highlight-hover-text::after {
    content: "";
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--highlight-underline-color1);
    opacity: 0.6;
    transition: opacity 0.4s ease, height 0.4s ease, background 0.4s ease;
}

.highlight-hover-text:hover {
    color: var(--highlight-hover-color);
    text-shadow: 0 0 10px var(--highlight-shadow-color);
}

.highlight-hover-text:hover::after {
    opacity: 1;
    height: 3px;
    background: linear-gradient(to right,
    var(--highlight-underline-color1),
    var(--highlight-underline-color2));
}

/* --- Last Checked Note --- */
.last-checked-note {
    font-size: 0.85rem;       /* Smaller font size */
    color: var(--silver-accent); /* Grey color like subtitle */
    font-style: italic;       /* Italic style */
    text-align: center;       /* Center the text */
    margin-top: 1.8rem;       /* Space above the note */
    padding-bottom: 0.5rem;   /* Little space below */
}

/* --- Minor adjustment for list spacing when note is present --- */
.link-list {
    margin-bottom: 0; /* Remove default bottom margin if any */
}