@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@200..800&display=swap');

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Assistant', sans-serif;
    background-color: #fff;
    color: #333;
    min-height: 100vh;
    direction: rtl;
}

/* Ensure Assistant font is applied to all elements */
* {
    font-family: 'Assistant', sans-serif;
}

/* Container */
.container {
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    min-width: 320px;
    max-width: 960px;
margin-top: 5px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 0;
    position: relative;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.header h1 {
    font-size: 2em;
    margin: 0;
    font-weight: bold;
    font-family: 'Assistant', sans-serif;
}

/* Mobile responsive header */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        margin-top: 9px;
    }
    
    .header .titles {
        order: 1;
        margin-top: -10px;
    }
    
    .header .header-controls {
        order: 2;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 5px;
        align-items: center;
        display: flex;
        flex-direction: row;
        justify-content: center;
    }
    
    .header h1 {
        font-size: 1.5em;
        text-align: center;
    }
    
    .difficulty-buttons {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
    }
    
    .difficulty-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .main {
        margin-top: -30px;
    }
    
}

/* Ranking Section */
.ranking-section {
    margin-bottom: 20px;
    display: flex;
    justify-content: end;
}

.help-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    transition: all 0.3s ease;
    margin-right: 0;
    width: 35px;
}

.help-toggle:hover {
    background-color: #f0f0f0;
}

.help-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #333;
    border-radius: 50%;
    text-align: center;
    line-height: 16px;
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 35px;
}

.theme-toggle:hover {
    background-color: #f0f0f0;
}

.theme-icon {
    width: 24px;
    height: 24px;
}

/* Difficulty Buttons */
.difficulty-buttons {
    display: flex;
    gap: 12px;
    flex-direction: row;
}

@media (min-width: 701px) {
    .difficulty-buttons {
        display: flex;
        gap: 12px;
        padding-left: 85px;
        width: 60%;
    }
    .titles h1 {
        font-size: 37px;
    }
    .titles span {
        font-size: 20px;
        font-weight: 300;
    }
    .titles {
        width: 66%;
        margin-top: -10px;
    }
    .rankingline {
        width: 28px;
    }

    .letters {
        margin-top: 20px;
    }
    .difficulty-btn {
        padding: 10px 18px;
        border: none;
        border-radius: 8px;
        background-color: #e4eaf3;
        color: #333;
        cursor: pointer;
        transition: all 0.3s ease;
        font-weight: bold;
        font-size: 18px;
        font-family: 'Assistant', sans-serif;
    }   

    .letters {
        margin-top: -80px;
    }

    .header {
        /*margin-top: -17px;*/
    }
  }

  @media (max-width: 700px) {

    .header .header-controls {
        order: 0;
        margin-top: -13px;
    }
    .titles {
        width: 100%;
    }
    .titles h1 {
        font-size: 37px;
    }
    .titles span {
        font-size: 20px;
        font-weight: 300;
    }
    .header-controls {
        flex-direction: column;
    }
    .rankingline {
        width: 20px;
    }

        
    .difficulty-btn {
        padding: 8px 9px;
        border: none;
        border-radius: 8px;
        background-color: #e4eaf3;
        color: #333;
        cursor: pointer;
        transition: all 0.3s ease;
        font-weight: bold;
        font-size: 17px;
        font-family: 'Assistant', sans-serif;
    }   
  }


.difficulty-btn:hover {
    background-color: #d0d0d0;
}

.difficulty-btn.active {
    background-color: #22c55e;
    color: white;
}

/* Main game area */
.main {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.letters {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 500px;
    position: relative; /* Allows outputdiv to position relative to letters container */
}

.words {
    border: solid;
    width: 400px;
    border-width: 1px;
    border-color: #dddddd;
    border-radius: 6px;
    padding: 0 20px;
    min-height: 625px;
    overflow-x: auto;
}

@media (max-width: 450px) {
    .words {
        width: 328px;
    }
}

/* Output/Error display */

.outputdiv {
    position: absolute;
    top: 20px; /* Position above inputdiv area */
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    text-align: center;
    font-size: 14px;
    background: black;
    color: white;
    padding: 7px 12px;
    border-radius: 5px;
    z-index: 10;
    pointer-events: none;
}

.outputdiv.correct {
    position: absolute;
    top: 20px; /* Position above inputdiv area */
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    text-align: center;
    font-size: 14px;
    background: white;
    color: black;
    padding: 7px 12px;
    border-radius: 5px;
    border: solid 1px #ccc;
    z-index: 10;
    pointer-events: none;
}

.correct .output {
    word-spacing: 5px;
    font-weight: 600;
}

.outputdiv.invisible {
    opacity: 0;
}

.outputdiv.fade-in {
    opacity: 1;
    transition: all 0.35s;
}

.outputdiv.fade-out {
    opacity: 0;
    transition: all 0.35s;
}

.outputdiv.success {
    animation: goUp 2s;
}

/* Input area */
.inputdiv {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    margin-top: 50px; /* Add space at top for outputdiv */
}

.input-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-display {
    display: inline-block;
    min-width: 200px;
    min-height: 50px;
    font-size: 28px;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 8px 16px;
    text-align: center;
    line-height: 1.2;
    position: relative;
  }
  
  /* סמן כתיבה מהבהב */
  .input-display::after {
    content: "";
    display: inline-block;
    width: 3px;
    height: 1.2em;
    margin-left: 3px;
    background-color: #f7da21 ;
    vertical-align: middle;
    animation: blink 1s linear infinite;
  }
  
  /* כל חצי שנייה מופיע ונעלם */
  @keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
  }
      

.inputplaceholder {
    color: #959595;
    font-size: 32px;
}

.inputdiv.fail {
    animation: shake 1s;
}

/* Control buttons */
.control-btn {
    display: flex;
    text-align: center;
    width: 3em;
    height: 3em;
    border: solid;
    border: 1px solid #dcdcdc;
    border-radius: 2.5em;
    padding: 15px 0;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    margin: 0 8px;
    background-size: 50%;
    background-repeat: no-repeat;
    background-position: center;
}

.delete-btn {
    background: url("close.png") center no-repeat;
    background-size: 50%;
}

.enter-btn {
    background: url("checkmark.png") center no-repeat;
    background-size: 60%;
}

/* Dark mode button icons */
.dark-mode .delete-btn {
    background: url("closewhite.png") center no-repeat;
    background-size: 50%;
}

.dark-mode .enter-btn {
    background: url("checkmarkwhite.png") center no-repeat;
    background-size: 60%;
}

.control-btn:active,
.control-btn:focus-visible {
    background-color: #e6e6e6;
}

/* Hive */
.hive {
    position: relative;
    width: 320px;
    padding-bottom: 320px;
    margin: 0;
}

.hivecell {
    position: absolute;
    top: 33.3333333333%;
    left: 30%;
    width: 40%;
    height: 33.3333333333%;
    user-select: none;
}

.hivecell:nth-child(1) {
    transform: translate(0, 0);
}

.hivecell:nth-child(2) {
    transform: translate(-75%, -50%);
}

.hivecell:nth-child(3) {
    transform: translate(0, -100%);
}

.hivecell:nth-child(4) {
    transform: translate(75%, -50%);
}

.hivecell:nth-child(5) {
    transform: translate(75%, 50%);
}

.hivecell:nth-child(6) {
    transform: translate(0, 100%);
}

.hivecell:nth-child(7) {
    transform: translate(-75%, 50%);
}

.hivecell .cellfill {
    cursor: pointer;
    fill: #e4eaf3;
    transition: stroke-width 100ms;
    stroke: white;
    stroke-width: 7.5;
}

.hivecell.center .cellfill {
    fill: #f7da21 !important;
}

.hivecell.center > .cellfill {
    fill: #f7da21 !important;
}

/* Additional rule to ensure center polygon is yellow */
.hivecell:first-child .cellfill {
    fill: #f7da21 !important;
}

.hive .cellletter {
    font-weight: 700;
    font-size: 2.125em;
    text-anchor: middle;
    text-transform: uppercase;
    pointer-events: none;
    fill: black;
}

.hivecell.center .cellletter {
    fill: #000 !important;
    font-weight: 700;
}

.cellfill:active {
    fill: #ddd;
    stroke-width: 10;
}

.hivecell.center > .cellfill:active {
    fill: #e7ce2a;
}

.hive.fade-in .hive-cell:not(.center) {
    fill: #e6e6e6;
    transition: fill 0.35s;
}

.hive.fade-out .hive-cell:not(.center) {
    fill: black;
    transition: fill 0.35s;
}

/* Action buttons */
.buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    gap: 8px;
}

.action-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 5.5em;
    height: 3em;
    border: solid;
    border: 1px solid #dcdcdc;
    border-radius: 2.5em;
    padding: 15px 0;
    cursor: pointer;
    user-select: none;
    margin: 0 8px;
    background: none;
    color: #333;
    font-weight: bold;
}

.shuffle-btn {
    background: url("shuffle.png") center no-repeat;
    background-size: 60%;
    width: 3em;
    height: 3em;
}

/* Dark mode shuffle icon */
.dark-mode .shuffle-btn {
    background: url("shufflewhite.png") center no-repeat;
    background-size: 60%;
}

.action-btn:active,
.action-btn:focus-visible {
    background-color: #e6e6e6;
}

.reveal-word-btn,
.yesterday-btn {
    margin-top: 10px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    padding: 15px 0 !important;
    flex: 0 0 calc(40% - 4px) !important;
    box-sizing: border-box !important;
    order: 10;
}

.reveal-word-btn {
    margin-right: 4px !important;
}

.yesterday-btn {
    margin-left: 4px !important;
}

/* Ranking system */
.rankings {
    display: flex;
    padding-right: 12px;
    height: 60px;
    cursor: pointer;
    width: 418px;
}

.rank {
    line-height: 3.1;
    width: 55px;
}

.rankingprogress {
    display: flex;
    margin: 0 auto;
}

.rankingdot {
    background-color: #ccc;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transform: translateY(28px);
}

.completedlevel.rankingdot {
    background-color: #f7da21;
}

.currentlevel.rankingdot {
    display: flex;
    background-color: #f7da21;
    width: 30px;
    height: 30px;
    transform: translateY(17px);
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #000;
    font-family: 'Assistant', sans-serif;
}

.rankingline {
    background-color: #ccc;
    height: 1px;
    transform: translateY(32px);
}

.rankingsquare {
    background-color: #ccc;
    width: 8px;
    height: 8px;
    transform: translateY(28px);
}

.currentlevel.rankingsquare {
    display: flex;
    background-color: #f7da21;
    width: 30px;
    height: 30px;
    transform: translateY(17px);
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #000;
}

/* Words section */
.words-section {
    margin-top: 20px;
}

.words-section h4 {
    margin-bottom: 10px;
}

.found-words {
    display: grid;
    grid-auto-flow: column;
    column-gap: 20px;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(25, auto);
}

.found-words p {
    min-width: 60px;
    max-width: 105px;
    border-bottom: 1px solid #ccc;
    margin-left: 20px;
    margin: 0;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 15px;
    font-size: 16px;
}

.linkdiv {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Letter styling in input */
.mainletter {
    color: #f7da21;
    font-weight: 700;
}

.rightletter {
    color: black;
    font-weight: 700;
}

.wrongletter {
    color: rgb(150, 150, 150);
    font-weight: 700;
}

/* Dark mode */
.dark-mode {
    background-color: #222222;
    color: white;
}

.dark-mode .hivecell .cellfill {
    fill: #e6e6e6;
    stroke: #222222;
}

.dark-mode .rightletter {
    color: white;
}

.dark-mode .wrongletter {
    color: rgb(80, 80, 80);
}

.dark-mode .control-btn {
    background-color: #444;
}

.dark-mode .delete-btn {
    background: url("closewhite.png") center no-repeat;
    background-size: 50%;
}

.dark-mode .enter-btn {
    background: url("checkmarkwhite.png") center no-repeat;
    background-size: 60%;
}

.dark-mode .shuffle-btn {
    background: url("shufflewhite.png") center no-repeat;
    background-size: 60%;
}

/* Animations */
@keyframes shake {
    0% { transform: translate(0px, 0px); }
    20% { transform: translate(-1px, 0px); }
    40% { transform: translate(1px, 0px); }
    60% { transform: translate(-1px, 0px); }
    80% { transform: translate(1px, 0px); }
    100% { transform: translate(0px, 0px); }
}

@keyframes goUp {
    0% { transform: translate(-50%, 5px); }
    100% { transform: translate(-50%, -5px); }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #f7da21; }
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h1, .modal-header h2 {
    margin: 0;
    color: #333;
}

.close {
    color: #333;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close:hover {
    color: #f44336;
}

.modal-body {
    padding: 20px;
}

/* FAQ Content */
.faq-content {
    max-height: 60vh;
    overflow-y: auto;
}

.faq-content h3 {
    color: #333;
    font-size: 16px;
    font-weight: bold;
    margin: 20px 0 10px 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.faq-content h3:first-child {
    margin-top: 0;
}

.faq-content p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

/* Tips Content */
.tips-content {
    max-height: 60vh;
    overflow-y: auto;
}

.tip-item {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.tip-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.tip-item h3 {
    color: #333;
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 10px 0;
}

.tip-item p {
    color: #666;
    line-height: 1.6;
    margin: 0 0 10px 0;
}

.tip-item ul {
    margin: 10px 0;
    padding-right: 20px;
}

.tip-item li {
    color: #666;
    line-height: 1.6;
    margin-bottom: 8px;
}

.tip-item strong {
    color: #333;
    font-weight: bold;
}

/* How to Play Modal Content */
.how-to-play-content {
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px;
}

.how-to-play-content h3 {
    color: #333;
    font-weight: bold;
    margin: 20px 0 10px 0;
    font-size: 16px;
}

.how-to-play-content ul {
    margin: 10px 0;
    padding-right: 20px;
}

.how-to-play-content li {
    margin: 8px 0;
    line-height: 1.5;
    color: #333;
}

/* Calendar Date Picker */
.calendar-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    width: 320px;
    padding: 0;
    overflow: hidden;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.calendar-nav {
    background: #f0f0f0;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.calendar-nav:hover {
    background: #e0e0e0;
}

.calendar-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.calendar-body {
    padding: 15px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    margin-bottom: 10px;
}

.weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    padding: 8px 0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
}

.calendar-date {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin: 1px;
}

.calendar-date:hover {
    background: #f0f0f0;
}

.calendar-date.other-month {
    color: #ccc;
}

.calendar-date.selected {
    background: #333;
    color: white;
    font-weight: 500;
}

.calendar-date.today {
    background: #f7da21;
    color: #000;
    font-weight: 500;
}

.calendar-date.disabled {
    color: #ccc;
    cursor: not-allowed;
}

.calendar-date.disabled:hover {
    background: transparent;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}


/* Share buttons */
.share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn {
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.share-btn:hover {
    transform: scale(1.05);
}

.share-btn img {
    width: 148px;
    height: 40px;
    border-radius: 4px;
}

/* Ranking list */
.ranking-list {
    margin-top: 20px;
}

.ranking-list h5 {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
}

.ranking-list p {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #ddd;
}

.ranking-list p.completed-rank {
    background-color: #4caf50;
    color: white;
    border-radius: 4px;
    padding: 8px 10px;
}

.ranking-list p.current-rank {
    background-color: #f7da21;
    color: black;
    border-radius: 4px;
    padding: 8px 10px;
    font-weight: bold;
}

.ranking-list p.genius-rank {
    background-color: #f44336;
    color: white;
    border-radius: 4px;
    padding: 8px 10px;
}

/* Toast notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #4caf50;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .difficulty-buttons {
        position: relative;
        top: auto;
        right: auto;
        justify-content: center;
        gap: 7px;
    }
    
    .letters {
        width: 100%;
    }
    
    /* Reorder elements on mobile: outputdiv, hive, inputdiv, buttons */
    .outputdiv {
        order: 0;
    }
    
    .hive {
        width: 280px;
        padding-bottom: 280px;
        order: 1;
    }
    
    .inputdiv {
        order: 2;
        margin-top: 18px;
    }
    
    .buttons {
        margin-top: 2px;
        padding-bottom: 18px;
    }
    
    .words {
        width: 100%;
        margin-top: -15px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .share-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .share-btn img {
        width: 120px;
        height: 32px;
    }
}


@media (max-width: 480px) {
    .hive {
        width: 330px;
        padding-bottom: 330px;
    }
    
    .input-controls {
        /*flex-direction: column;*/
        gap: 5px;
    }
    
    .input-display {
        min-width: 195px;
    }

    .action-btn {
        width: 5.5em;
        height: 3em;
        font-size: 15px;
        font-weight: normal;
    }

    .hivecell .cellfill {
        stroke-width: 4.5;
    }

    .shuffle-btn {
        width: 3em;
    }
}