body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: rgba(0, 0, 0, 0); /* Transparent for OBS */
    color: white;
    margin: 0;
    padding: 10px; /* Reduced padding */
    overflow: hidden;
}

.container {
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px; /* Reduced padding from 15px */
    border-radius: 12px;
    width: 320px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.header {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 5px; /* Reduced margin from 10px */
    position: relative; /* Allow children to position relative to container */
}

.title-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    width: 100%; /* Ensure full width for centering */
}

.controls-wrapper {
    position: relative;
    align-self: center;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    z-index: 20;
}

.settings-icon, .reset-icon, .toggle-icon, .link-icon, .clear-icon {
    cursor: pointer;
    font-size: 1.2em; /* Reduced size */
    opacity: 0.5;
    transition: opacity 0.3s;
    z-index: 10;
    padding: 5px; /* Increase click area */
    margin-left: 5px;
}

.settings-icon:hover, .reset-icon:hover, .toggle-icon:hover, .link-icon:hover, .clear-icon:hover {
    opacity: 1;
}

h1 {
    text-align: center;
    margin: 0;
    font-size: 2em; /* Slightly reduced from 2.2em */
    line-height: 1.1; /* Tighter line height */
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(180deg, #ffcc00 0%, #ff4d4d 50%, #cc0000 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(2px 2px 0px #000);
    position: relative;
    z-index: 1;
}

/* Notification Area */
.notification {
    background-color: #ffcc00;
    color: #000;
    padding: 10px; /* Reduced padding */
    margin-bottom: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 1em; /* Reduced font size */
    animation: slideDown 0.5s ease-out;
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.6);
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Timer Display */
.timer {
    text-align: center;
    font-size: 1.5em; /* Reduced font size */
    font-weight: bold;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px; /* Reduced padding */
    border-radius: 8px;
    margin-bottom: 15px;
    border: 2px solid #ff4d4d;
    box-shadow: 0 0 10px rgba(255, 77, 77, 0.3);
}

.timer.ended {
    background: #ff4d4d;
    color: white;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Target Word Display */
.target-words-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px; /* Reduced gap */
    margin-bottom: 15px;
    justify-content: center;
}

.target-word-item {
    background: linear-gradient(90deg, #ff4d4d, #ff8c00);
    padding: 6px 10px; /* Reduced padding */
    border-radius: 6px;
    display: flex;
    align-items: center;
    font-size: 1em; /* Reduced font size */
    box-shadow: 0 4px 10px rgba(255, 77, 77, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    min-width: 120px; /* Reduced width */
}

.target-word-item .label {
    font-size: 0.7em;
    opacity: 0.8;
    margin-right: 8px;
}

.target-word-item .text {
    font-weight: bold;
    text-transform: uppercase;
    flex-grow: 1;
    text-align: left;
    margin-right: 8px;
}

.target-word-item .count {
    background: white;
    color: #ff4d4d;
    padding: 1px 8px;
    border-radius: 12px;
    font-weight: bold;
    min-width: 15px;
    text-align: center;
}

/* Layout Variants */
/* Vertical Right */
body.layout-vertical-right {
    display: flex;
    justify-content: flex-end;
}

/* Horizontal Top */
body.layout-horizontal-top,
body.layout-horizontal-bottom {
    padding: 0;
}

/* Horizontal Bottom Specifics */
body.layout-horizontal-bottom {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100vh;
    box-sizing: border-box;
}

body.layout-horizontal-top .container {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

body.layout-horizontal-bottom .container {
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.8);
}

body.layout-horizontal-top .container,
body.layout-horizontal-bottom .container {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 5px 15px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 0;
    gap: 15px;
}

body.layout-horizontal-top .header,
body.layout-horizontal-bottom .header {
    margin-bottom: 0;
    margin-right: 10px;
    position: static; /* Allow absolute children to reference container */
}

body.layout-horizontal-top .title-wrapper,
body.layout-horizontal-bottom .title-wrapper {
    margin-right: 0;
    align-items: flex-start;
}

body.layout-horizontal-top h1,
body.layout-horizontal-bottom h1 {
    font-size: 1.2em;
    white-space: nowrap;
}

body.layout-horizontal-top .channel-display,
body.layout-horizontal-bottom .channel-display {
    display: none !important;
}

body.layout-horizontal-top .controls-wrapper,
body.layout-horizontal-bottom .controls-wrapper {
    position: absolute; /* Stick to right of container */
    right: 40px; /* Moved inward from 15px */
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0;
    order: unset;
}

body.layout-horizontal-top #word-list,
body.layout-horizontal-bottom #word-list {
    display: flex;
    flex-direction: row;
    gap: 10px;
    position: absolute; /* Absolute center */
    left: 50%;
    transform: translateX(-50%);
    justify-content: center;
    width: auto;
    white-space: nowrap;
}

body.layout-horizontal-top #word-list.hidden,
body.layout-horizontal-bottom #word-list.hidden {
    display: none !important;
}

body.layout-horizontal-top .word-item,
body.layout-horizontal-bottom .word-item {
    margin-bottom: 0;
    padding: 4px 8px;
    font-size: 0.9em;
    white-space: nowrap;
}

body.layout-horizontal-top .word-count,
body.layout-horizontal-bottom .word-count {
    margin-left: 5px;
}

body.layout-horizontal-top .timer,
body.layout-horizontal-bottom .timer {
    margin-bottom: 0;
    padding: 2px 6px;
    font-size: 1em;
    margin-right: 10px;
    white-space: nowrap;
}

body.layout-horizontal-top .target-words-container,
body.layout-horizontal-bottom .target-words-container {
    margin-bottom: 0;
    flex-wrap: nowrap;
    margin-right: 10px;
}

body.layout-horizontal-top .target-word-item,
body.layout-horizontal-bottom .target-word-item {
    padding: 2px 6px;
    font-size: 0.8em;
    min-width: auto;
}

/* Hide notification in horizontal mode or adjust it? */
body.layout-horizontal-top .notification {
    position: absolute;
    top: 60px; /* Below the bar */
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

body.layout-horizontal-bottom .notification {
    position: absolute;
    bottom: 60px; /* Above the bar */
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

/* Modal Styles */
.modal {
    display: flex;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none !important;
}

.modal-content {
    background-color: #2a2a2a;
    padding: 0; /* Remove global padding */
    border-radius: 10px;
    width: 450px; /* Increased width */
    max-height: 85vh;
    position: relative;
    box-shadow: 0 0 20px rgba(255, 77, 77, 0.3);
    text-align: left;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 15px;
    background-color: #2a2a2a;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    border-radius: 10px 10px 0 0;
}

.modal-body {
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.modal-content h2 {
    text-align: center;
    color: #ff4d4d;
    margin: 0;
}

.close {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 30;
}

.settings-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 3px solid #ff4d4d;
}

.settings-section h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1em;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 5px;
}

.close:hover,
.close:focus {
    color: white;
    text-decoration: none;
    cursor: pointer;
}

.input-group {
    margin-bottom: 12px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
    color: #ddd;
    font-size: 0.9em;
}

.input-group input {
    width: 100%;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #555;
    background-color: #333;
    color: white;
    box-sizing: border-box;
}

select {
    width: 100%;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #555;
    background-color: #333;
    color: white;
    box-sizing: border-box;
}

button {
    background-color: #ff4d4d;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 15px;
    width: 100%;
    font-weight: bold;
    transition: background-color 0.3s;
    margin-top: 8px;
}

button:hover {
    background-color: #cc0000;
}

.word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    margin-bottom: 6px; /* Reduced margin */
    padding: 6px 10px; /* Reduced padding */
    border-radius: 6px;
    font-size: 1.1em; /* Reduced font size */
    animation: popIn 0.3s ease-out;
}

.word-info {
    display: flex;
    align-items: center;
    flex-grow: 1;
    overflow: hidden;
    margin-right: 10px;
}

.rank-icon {
    font-weight: 900;
    color: #ffcc00;
    margin-right: 8px;
    font-size: 0.9em;
    min-width: 25px; /* Alignment */
    text-align: center;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    padding: 2px 4px;
}

.word-text {
    font-weight: bold;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.word-count {
    background: #ff4d4d;
    padding: 2px 8px;
    border-radius: 15px;
    font-size: 0.8em;
    min-width: 25px;
    text-align: center;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Confirmation Modal Specifics */
.confirmation-content {
    width: 300px;
    text-align: center;
}

.session-content {
    width: 500px;
    text-align: center;
}

#new-session-url {
    font-family: monospace;
    font-size: 1.2em;
    padding: 10px;
    background: rgba(0,0,0,0.3);
    cursor: text;
}

.confirmation-buttons {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
}

.confirm-btn {
    width: 40%;
    margin-top: 0;
}

.confirm-btn.yes {
    background-color: #ff4d4d;
}

.confirm-btn.yes:hover {
    background-color: #cc0000;
}

.confirm-btn.no {
    background-color: #555;
}

.confirm-btn.no:hover {
    background-color: #777;
}

/* Fire Animation */
.fire-icon {
    display: inline-block;
    animation: fire-flicker 1.5s infinite ease-in-out;
}

@keyframes fire-flicker {
    0% { transform: scale(1); filter: brightness(100%); }
    50% { transform: scale(1.2); filter: brightness(130%); }
    100% { transform: scale(1); filter: brightness(100%); }
}

/* Welcome Screen */
.welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column; /* Stack content and footer */
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    z-index: 2000;
    overflow-y: auto; /* Allow scrolling if content is too tall */
}

.footer-credits {
    margin-top: 20px;
    color: #888;
    font-size: 0.9em;
    text-align: center;
    padding-bottom: 20px;
    width: 100%;
}

.footer-credits a {
    color: #ffcc00;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s;
}

.footer-credits a:hover {
    color: #fff;
    text-decoration: underline;
}

.welcome-content {
    background: rgba(30, 30, 30, 0.95);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(255, 77, 77, 0.2);
    border: 1px solid #333;
    max-width: 1200px; /* Much wider for side-by-side layout */
    width: 95%;
    margin: 20px auto; /* Ensure some margin on small screens */
}

.welcome-grid {
    display: flex;
    flex-wrap: wrap; /* Stack on small screens */
    gap: 30px;
    text-align: left;
    margin-top: 30px;
}

.welcome-column {
    flex: 1;
    min-width: 300px; /* Force stacking on mobile */
    display: flex;
    flex-direction: column;
}

/* Feature List Updates */
.feature-list {
    flex-grow: 1;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px; /* Increased gap for better readability */
}

.feature-item {
    display: flex;
    align-items: flex-start; /* Align icon to top if text wraps */
    color: #ddd;
    font-size: 1.05em; /* Slightly smaller to fit more */
    line-height: 1.4;
}

.feature-item strong {
    color: #ffcc00; /* Highlight key terms */
}

.feature-icon {
    margin-right: 15px;
    font-size: 1.3em;
    min-width: 30px; /* Prevent icon from squishing */
    text-align: center;
    margin-top: 2px; /* Slight visual adjustment for flex-start */
}

.feature-list h3 {
    margin-top: 0;
    color: #ffcc00;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.action-area {
    text-align: center;
    background: rgba(0,0,0,0.2);
    padding: 30px;
    border-radius: 10px;
    margin-top: 30px; /* Space from the grid */
    width: 100%;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    border: 1px solid rgba(255, 77, 77, 0.3);
}

/* Setup Guide Updates */
.setup-guide {
    margin-top: 0; /* Reset previous margin */
    height: 100%; /* Fill column */
}

.examples-section {
    margin-top: 25px; 
    padding-top: 20px; 
    border-top: 1px solid rgba(255,255,255,0.1);
}

.examples-section h3 {
    color: #fff;
    font-size: 1.1em;
    margin-top: 0;
}

.examples-list {
    margin: 0;
    padding-left: 25px;
    color: #ccc;
    text-align: left;
}

.examples-list li {
    margin-bottom: 8px;
    line-height: 1.4;
}

.primary-btn {
    background: linear-gradient(90deg, #ff4d4d, #ff8c00);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2em;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 77, 77, 0.4);
}

.subtext {
    font-size: 0.8em !important;
    color: #666 !important;
    margin-top: 15px !important;
    margin-bottom: 0 !important;
}
