:root {
    
    --hex-width: clamp( 28px, 10.8cqw, 68px );
    --hex-height: clamp( 32px, 11.4cqw, 76px );
    --hex-letter-size: clamp( 0.8rem, 4cqw, 1.3rem );
    --hex-score-size: clamp( 0.4rem, 2cqw, 0.8rem );
    --hex-score-padding: 0 0 0.2em 0;
    --hex-gap: 0.5cqw;
    --hex-letter-weight: 450;
    
    --hex-border: #BA7;
    --hex-color: #F9EEDF;
    --hex-hover-color: #F0D47A;
    --hex-color-highlight: #E0C050;
    --hex-color-double: #DECEBC;
    --hex-color-double-hover: #D0B05A;
    --hex-color-double-highlight: #C0A04A;
    --hex-letter-color: #555;
    
}

@media( min-width: 420px ){
	:root{
    --hex-score-padding: 0em 0 0.2em 0;
    --hex-gap: 3px;
    --hex-letter-weight: 750;
	}
}

.honeycomb-game{
	margin: 0 0 4rem 0;
}

.honeycomb-game-wrapper{
	display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
	container-type: inline-size;
	container-name: grid;
}

.honeycomb-grid {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Flush left as requested */
    padding: 5px;
    user-select: none; /* Prevents accidental text highlighting while playing */
}

.hex-row {
    display: flex;
    /* Move every row up to 'nestle' into the one above */
    margin-top: calc(var(--hex-height) * -0.25 + var(--hex-gap));
}

.hex-row:first-child {
    margin-top: 0;
}

/* This targets the 2nd, 4th, 6th rows (Index 1, 3, 5) */
.hex-row:nth-child(even) {
    margin-left: calc(var(--hex-width) / 2 + var(--hex-gap) / 2);
}

.hexagon {
    width: var(--hex-width);
    height: var(--hex-height);
    margin: 0 calc(var(--hex-gap) / 2);
    
    /* The Geometric Heart: Creates a true 6-sided clipping mask */
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* border: 1px solid var(--hex-border); Note: clip-path hides real borders */
    position: relative;
    color: var( --text-dark );
    background-color: var(--hex-border) !important;
}

/* Since clip-path cuts off borders, we use a pseudo-element for the 'line' */
.hexagon::after {
    content: "";
    position: absolute;
    inset: 2px; /*Slight inset to simulate a border*/
    clip-path: inherit;
    z-index: -1;
    background-color: var(--hex-color) !important;
}

.hexagon:hover {
    /*background-color: #f9f7f2;
    background-color: var( --hex-hover-color ) !important;
    transform: scale(1.05);*/
    z-index: 10;
}

.hexagon:hover::after {
    background-color: var( --hex-hover-color ) !important;
}

/* Ensure the highlight is visible behind the new content */
.hexagon.active::after {
    background-color: var( --hex-color-highlight ) !important;
}

.hexagon.active .score {
    opacity: 1;
}

.hex-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    position: relative;
    width: 100%;
    height: 100%;
}

.hex-letter {
    font-family: var( --font-display );
    font-size: var( --hex-letter-size );
    font-weight: 600;
    line-height: 1;
    color: var( --hex-letter-color );
}

.hex-score {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    font-size: var( --hex-score-size );
    font-weight: 800;
    opacity: 0.9;
    margin: 0 auto 0 auto;
    padding: 0 0 0 0;
    text-align: center;
    color: var( --link-dark );
    line-height: 2.5em;
}

/* The Bonus Cell - Warm, like aged honey */
.hexagon-double {
    background-color: var( --hex-border-color );
    /*border: 1px solid #e6b800;*/
}

.hexagon-double::after {
    content: '';
    position: absolute;
    /*top: 15%; 
    left: 15%; 
    width: 70%; 
    height: 70%;*/
    /*inset: 1px;*/
    /*clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);*/
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    pointer-events: none;
    opacity: 1;
    background-color: var( --hex-color-double ) !important;
}

/* The Bonus Cell - Warm, like aged honey */
.hexagon-double:hover::after {
    background-color: var( --hex-color-double-hover ) !important;
}

/* The Bonus Cell - Warm, like aged honey */
.hexagon-double.active::after {
    background-color: var( --hex-color-double-highlight ) !important;
}


/* The Scoreboard */

.honeycomb-game-score{

	display: flex;
	flex-direction: column;
	justify-content: space-between;
	align-items: flex-start;
	margin: 1em 0 1em 0;
	padding: 0;
	width: 100%;
  	padding: 0 0;
    row-gap: 2rem;
}

.honeycomb-game-current-word{
	display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    flex-grow: 1;
	width: 100%;
}
.honeycomb-current-word-display{
	display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    border-bottom: solid 1px #1116;
}
.honeycomb-current-word-status{
	display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    flex-grow: 1;
    column-gap: 1rem;
    padding: 0.25em;
}
.honeycomb-timer-container {
    display: grid;
    place-items: center;
    border-radius: 3px;
    color: var( --text-color );
    padding: 0.25em 0 0.25em 0;
    width: 100%;
}

.honeycomb-timer-countdown {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.5rem;
    font-weight: 800;
    color: var( --text-color );
    white-space: nowrap;
    padding: 0.25em 1em 0.25em 0.75em;
}
@media( min-width: 420px ){
    .honeycomb-timer-countdown {
		padding: 0.25em 1em 0.25em 0.75em;
	}
}

.honeycomb-timer-countdown.honeycomb-timer-disabled {
    color: var( --text-color );
    animation: none;       /* Disable any pulsing */
    opacity: 0.4;
}

.honeycomb-game .honeycomb-word-preview {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    font-family: var( --font-sans );
    column-gap: 1rem;
    row-gap: 0.5rem;
    margin: 0 0 0 0;
    width: 100%;
    padding: 1rem 0;
}

.honeycomb-current-word-text {
    font-size: 1.15rem;
    font-style: italic;
    color: var( --dark-muted-putty );
    font-weight: 500;
    text-transform: capitalize;
    border: none;
    background-color: transparent;
    width: 100%;
    overflow: hidden;
  	text-overflow: ellipsis;
  	padding: 0 1em;
    flex-grow: 1;
    outline: none;
    opacity: 0.7;
}

.honeycomb-current-word-text::after {
	content: '.';
}

.honeycomb-current-word-text.valid {
    font-size: 1.25rem;
    font-style: italic;
    color: var( --text-dark ) !important;
    opacity: 1;
}

.honeycomb-current-word-text::placeholder {
    font-size: 1.05rem;
    font-style: italic;
    font-weight: 500;
    text-transform: none;
    opacity: 1;
    color: var( --text-dark ) !important;
}

.honeycomb-game .honeycomb-word-preview-controls {
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	padding: 0 0 0 1rem;
}

.honeycomb-current-score-number {
    font-family: var( --font-sans );
    font-size: 1.8rem;
    font-weight: 600;
    opacity: 0.6;
    color: var( --dark-muted-putty );
}

.honeycomb-current-score-number.valid {
    font-family: var( --font-sans );
    font-size: 1.8rem;
    font-weight: 600;
    opacity: 1;
}

.honeycomb-proximity-hint-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    padding: 0 0 0 1rem;
}

.honeycomb-proximity-hint {
    display: block;
    font-family: var( --font-sans );
    font-style: italic;
    font-size: 0.95rem;
    transition: opacity 0.5s ease;
    line-height: 1.2;
}

.honeycomb-error{
	display: none;
	margin: 2rem 0;
}

.honeycomb-error P{
	font-size: 0.95rem;
	font-style: italic;
	font-family: var( --font-sans );
	font-weight: 600;
	line-height: 1.4em;
	max-width: 480px;
	margin: 0 auto 0 0;
	text-wrap: balance;
}

.honeycomb-error.active{
	display: block;
}

.honeycomb-jar{
	
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	align-items: flex-start;

}

/* The Add Button */
.honeycomb-store-word-button {
    display: inline-block;
    padding: 12px;
    margin: 0;
    font-family: var( --font-sans );
    font-weight: 800;
    text-transform: uppercase;
    background-color: var( --link-dark ); /* Disabled state */
    color: var( --text-light );
    border: none;
    border-radius: 4px;
    cursor: not-allowed;
    transition: all 0.3s ease;
    opacity: 0.2;
}

/* The Store Button active state */
.honeycomb-store-word-button.btn-active {
    background-color: var( --link-dark ) !important; /* Sienna */
    color: var( --text-light ) !important;
    transform: translateY(-2px);
    cursor: pointer;
    opacity: 1;
}

.honeycomb-store-word-button.btn-active:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #5d2906;
}

/* The Honey Jar List */
.honey-jar-container {
    padding: 0;
    width: 100%;
}

.honey-jar-container h3{
    display: flex;
    align-items: center;
    color: var( --text-dark );
    font-size: 1rem;
    column-gap: 0.5em;
    font-style: normal;
    font-weight: 600;
}

.honey-jar-container .honeycomb-total-score-number{
    color: var( --link-dark );
    font-weight: 700;
    font-size: 1.6rem;
}

.honey-jar-list {
    display: flex;
    flex-direction: column;
    row-gap: 0.5rem;
    width: min-content;
    max-width: 100%;
    min-width: 220px;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 1rem 0 0 0;
    font-style: italic;
}

.honey-jar-list::-webkit-scrollbar {
    width: 6px;
}

.honey-jar-list::-webkit-scrollbar-thumb {
    background: #eaddca;
    border-radius: 10px;
}

.honey-jar-item {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #1112;
    animation: slideIn 0.4s ease-out forwards;
    column-gap: 12px;
    text-overflow: ellipsis;
    overflow: hidden;
    text-transform: capitalize;
    padding: 0 0 0.5em 0;
}

.honey-jar-word {
    font-family: var( --font-sans );
    font-weight: 500;
    text-transform: lowercase;
}

.honey-jar-score {
    font-weight: 800;
    color: var( --link-dark );
}

/* Animation for the 'Cinema' feel */
@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.honeycomb-timer-control-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 0;
    column-gap: 10px;
}

.honeycomb-timer-control-wrapper .mode-label{
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.95rem;
    font-weight: 500;
}

.honeycomb-timer-toggle-btn {
    position: relative;
    width: 50px;
    height: 26px;
    background-color: #ccc;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    padding: 0;
}

/* The "On" state for the background */
.honeycomb-timer-toggle-btn.is-on {
    background-color: sienna;
}

/* The sliding knob */
.honeycomb-toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Move the knob when active */
.honeycomb-timer-toggle-btn.is-on .toggle-slider {
    transform: translateX(24px);
}

/* Focus state for accessibility */
.honeycomb-timer-toggle-btn:focus-visible {
    outline: 2px solid #e6b800;
    outline-offset: 3px;
}

/* Pulsing red effect for the final 10 seconds */
.honeycomb-timer-low {
    color: #d9534f;
    animation: timerPulse 1s infinite;
}

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

@keyframes hexPop {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.5); opacity: 0; }
    51% { transform: scale(1.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.hex-refreshing .hex-content {
    animation: hexPop 0.5s ease-in-out;
}

.honeycomb-game-controls{
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	row-gap: 0px;
	margin: 0 0 1em 0;
	padding: 0;
}

.honeycomb-game-new-wrapper{
	display: flex;
	flex-direction: column;
	row-gap: 6px;
	margin: 0 0 0 0;
	padding: 0;
	justify-content: space-between;
	align-items: flex-start;
	justify-self: start;
}

.honeycomb-game-controls .honeycomb-new-game-button{
	all: unset;
	display: flex;
	flex-direction: row;
	align-items: center;
	column-gap: 0.5rem;
	color: var( --link-dark );
	text-align: center;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	font-size: 0.75rem;
	cursor: pointer;
	border: none;
	justify-self: right;
	padding: 8px 16px;
	padding: 0 0 0 0;
	font-weight: 750;
}

.honeycomb-game-controls .honeycomb-new-game-button::before{
	display: block;
	background-color: var( --link-dark );
	width: 28px;
	height: 28px;
	content: '';
	background-image: url( '/icons/new-light.svg' );
	Background-position: center;
	background-repeat: no-repeat;
	background-size: 18px;
	border-radius: 6px;
}

.honeycomb-game-status{  }

.dialog .honeycomb-overlay-title {
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: 20px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 1.2rem;
    margin-bottom: 3rem;
    text-align: center;
}

.honeycomb-final-stats-row {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    column-gap: 1rem;
    row-gap: 2rem;
    text-align: center;
}

.honeycomb-stat-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
    column-gap: 20px;
}

.honeycomb-stat-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
    color: var( --text-color );
    margin-bottom: 5px;
}

.honeycomb-final-total, .honeycomb-final-word-count {
    font-size: 2.5rem;
    font-weight: bold;
    color: #A0522D;
}

.dialog .honeycomb-overlay-hint{
	font-style: italic;
    align-self: center;
    margin-top: 3rem;
}

/* The Button */
.honeycomb-new-btn {
    align-self: center;
    background: var( --light-muted-putty );
    padding: 1.2em 2.4em;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
    color: var( --text-dark );
    cursor: pointer;
    transition: transform 0.1s;
    border: none;
    font-size: 0.95rem;
}

.honeycomb-new-btn:hover {
    background: var( --muted-putty );
    color: var( --text-light );
}

.honeycomb-mode-selector {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    row-gap: 10px;
    margin: 20px 0;
}

.honeycomb-mode-btn {
    cursor: pointer;
    position: relative;
}

.honeycomb-mode-btn input {
    position: absolute;
    opacity: 0;
}

.honeycomb-mode-btn span {
    display: flex;
    flex-direction: row;
    align-items: center;
    column-gap: 0.5rem;
    font-family: var( --font-sans );
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.1s ease;
    filter: grayscale( 100% );
    opacity: 0.5;
    font-size: 0.75rem;
    color: var( --link-dark );
}

.honeycomb-mode-btn span::before{
	display: block;
	border: solid 1px var( --text-dark );
	border-radius: 3px;
	width: 20px;
	height: 20px;
	content: '';
	text-align: center;
    font-size: 0.9rem;
    background-color: var( --link-dark );
    color: var( --text-light );
}

.honeycomb-mode-btn input:checked + span {
    color: var( --link-dark );
    z-index: 2;
    filter: grayscale( 0% );
    opacity: 1;
}

.honeycomb-mode-btn input:checked + span::before{
    background-color: var( --link-dark );
    color: var( --text-light );
	content: '';
	background-image: url( '/icons/check-light.svg' );
	Background-position: center;
	background-repeat: no-repeat;
	background-size: 18px;
}
